Revamp avatar service registry API

Review Request #8479 - Created Oct. 20, 2016 and submitted

Barret Rennie
Djblets
release-0.10.x
8480, 8481
djblets

AvatarServices now require an AvatarSettingsManager class when
being instantiated. Previously, this was an optional argument that
defaulted to the default AvatarSettingsManager which throws
NotImplementedError for all its methods. However, registries were not
guaranteed to return any third party avatar services instantiated with
the correct settings manager.

This has been corrected by making the avatar services registry always
store instances instead. It has simplified the API as now most things
can be done via method calls with the AvatarService class as an
argument instead of its avatar_service_id attribute. It also has the
benefit of making unit tests more succinct.

The AvatarServicesRegistry's get_avatar_service, for_user, and
configurable_services nethods have been re-written to return an
instance of the requested avatar service, instantiated with the
correct settings manager class.

Unit tests & the rest of the avatar services suite have been
re-written in light of these changes.

Ran unit tests.
Tested avatar services still work with Review Board.

  • 7
  • 0
  • 9
  • 1
  • 17
Description From Last Updated
These should be absolute class paths. Christian Hammond Christian Hammond
Since the else clause returns, how about: if service is None: return None if not self.is_enabled(service): ... ... Christian Hammond Christian Hammond
type here and below (sorry!) Christian Hammond Christian Hammond
No blank line. Christian Hammond Christian Hammond
This can be: configuration = self._settings_manager_class(user).configuration_for( self.avatar_service_id) It fits in the line. Christian Hammond Christian Hammond
"subclassed" Christian Hammond Christian Hammond
"URLs" Christian Hammond Christian Hammond
Review Bot
Barret Rennie
Review Bot
David Trowbridge
Barret Rennie
Review Bot
Barret Rennie
Review Bot
Barret Rennie
Review Bot
David Trowbridge
David Trowbridge
Barret Rennie
Review Bot
Barret Rennie
Review Bot
David Trowbridge
Christian Hammond
Barret Rennie
Review request changed

Status: Closed (submitted)

Change Summary:

Pushed to release-0.10.x (fc23582)
Loading...