Serialize avatar URL in user resource only when URLs available

Review Request #9457 — Created Dec. 19, 2017 and submitted — Latest diff uploaded

Information

Review Board
release-3.0.x
ed1a82f...

Reviewers

Previously we assumed that all avatar services would return URLs.
However, it is possible that the service has yet to be configured for a
user (e.g., they haven't uploaded an avatar yet for the
FileUploadAvatarService) or the avatar service returns bad data. In
these cases, we now wrap the serialization in a try..except to ensure
that we don't cause exceptions that crash the resource.

Additionally, we also ensure that we serialize the avatar_urls field
as {} instead of None when there are no URLs to simplify
deserialization logic.

Ran unit tests.

    Loading...