Add the avatar services registry
Review Request #7809 — Created Dec. 15, 2015 and submitted
The avatar services registry is a new object for managing avatar
services, which are defined to provide Review Board multiple ways of
displaying user avatars. Currently, the only supported avatar service
is the Gravatar (http://gravatar.com) service, which is what Review
Board supported previously.This patch, however, does not migrate to use the new avatar services.
Generated serach indexes have also been added to
.gitignore
.
Ran unit tests.
Used this in an upcoming patch.
Description | From | Last Updated |
---|---|---|
Should use ugettext_lazy |
david | |
Docstring? |
david | |
Since we render with a size specified, we should probably include width and height parameters in this tag. Also, can … |
david | |
We should mark_safe this. |
david | |
Col: 25 E241 multiple spaces after ':' |
reviewbot | |
Col: 29 E241 multiple spaces after ':' |
reviewbot | |
Col: 19 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Col: 17 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 32 E241 multiple spaces after ':' |
reviewbot | |
I know it wasn't already, but can we alphabetize this list? |
david | |
Perhaps we should rename these so they start with avatar_service so they all bunch together? |
david | |
Let's go into a little more detail on this, at the very least saying "avatar services," but ideally clarifying what … |
chipx86 | |
Swap these. |
chipx86 | |
Ordering is backwards. |
chipx86 | |
Similar comment to my other review. We should have a capital letter after the ":", since that's typically how errors … |
chipx86 | |
Blank line between these. |
chipx86 | |
A property should generally have the same type as both the getter and setter. In this case, we're using a … |
chipx86 | |
~ before the class path? |
chipx86 | |
Localized? |
chipx86 | |
Seeing a lot of inconsistency with the class paths in the docs. Some say reviewboard.accounts.avatars.services, some reviewboard.avatars.service, and some reviewboard.avatars.services. |
chipx86 | |
Might wrap better as: raise ItemLookupError( '...' % service) Same below. Also, these should be localized. |
chipx86 | |
I'm not sure it's clear what this really means, as written. Same below. Can we say what saving means, or … |
chipx86 | |
Sort of hitting a parse error with this sentence. |
chipx86 | |
Not necessarily true. Maybe: Whether the registry of avatars was newly populated by this call. If ``False``, the registry was … |
chipx86 | |
We know we're saving below, so probably no need to do that here. |
chipx86 | |
Should pass the service ID as a parameter, rather than a format string. |
chipx86 | |
"set"/"unsetting" doesn't mean a lot outside of the internals of the registries, I don't think. Maybe we can reword this? |
chipx86 | |
This is an internal detail I'd really rather not expose. It's cheap to fetch the SiteConfiguration, since we cache it, … |
chipx86 | |
Since this is something that developers will be interacting with, this should go into a lot more detail on what … |
chipx86 | |
This should go into more detail on what's expected and what's provided to the template. |
chipx86 | |
How about "The user whose avatar URL will be retrieved." |
chipx86 | |
Let's add "in pixels," and that this will be applied to both the width and the height. |
chipx86 | |
"... to HTML." This should go into more detail about how it's rendered (using template), and that it can be … |
chipx86 | |
Let's cache these on the request, taking into account the user ID and size. This will give us a nice … |
chipx86 | |
Let's have this in its own file. Refer to my thoughts at the top about directory structure. |
chipx86 | |
Two blank lines. |
chipx86 | |
This is kind of oddly written, and doesn't make it clear that service_id can impact this. This should be more … |
chipx86 | |
Let's pass the values as keyword arguments, in case we extend down the road. |
chipx86 | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Col: 25 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Col: 19 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 29 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 32 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 17 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 39 E241 multiple spaces after ':' |
reviewbot | |
Col: 32 E241 multiple spaces after ':' |
reviewbot | |
Col: 25 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Col: 19 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 29 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 17 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Two blank lines. |
chipx86 | |
This needs more detail on what this does and how it works, for people not familiar with what we're doing. |
chipx86 | |
This shouldn't have to be called here. It's already managed by the middleware and app initialize stuff, and when setting … |
chipx86 | |
This makes me nervous. Can we just set the things we need? |
chipx86 | |
'django_reset' imported but unused |
reviewbot | |
'from settings_local import *' used; unable to detect undefined names |
reviewbot | |
'PIPELINE_CSS' imported but unused |
reviewbot | |
'PIPELINE_JS' imported but unused |
reviewbot | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Things are misaligned here. Can we just shift this to be pep-8 style (even though it's not quite as pretty … |
david | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 24 E241 multiple spaces after ':' |
reviewbot | |
Col: 25 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 23 E241 multiple spaces after ':' |
reviewbot | |
Col: 19 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 29 E241 multiple spaces after ':' |
reviewbot | |
Col: 30 E241 multiple spaces after ':' |
reviewbot | |
Col: 31 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
Col: 26 E241 multiple spaces after ':' |
reviewbot | |
Col: 28 E241 multiple spaces after ':' |
reviewbot | |
Col: 17 E241 multiple spaces after ':' |
reviewbot | |
Col: 22 E241 multiple spaces after ':' |
reviewbot | |
This should all fit on one line. |
david | |
'django_reset' imported but unused |
reviewbot | |
'from settings_local import *' used; unable to detect undefined names |
reviewbot | |
'PIPELINE_CSS' imported but unused |
reviewbot | |
'PIPELINE_JS' imported but unused |
reviewbot | |
'django_reset' imported but unused |
reviewbot | |
'from settings_local import *' used; unable to detect undefined names |
reviewbot | |
'PIPELINE_CSS' imported but unused |
reviewbot | |
'PIPELINE_JS' imported but unused |
reviewbot |
- Change Summary:
-
Address David's issues.
- Diff:
-
Revision 2 (+653 -17)
-
The directory structure's feeling a bit deep. I get that avatars relate to accounts, but they're not necessarily a part of an account. I can see, for instance, us enhancing this later to let us get an avatar for a remote service, like a GitHub account, without having a local account. Maybe.
Anyway, room for debate here, but I feel like
reviewboard.avatars
is a fine namespace for this. Allows this to really be solely about avatars, without needing to be, like, a utility service of accounts (which the current directory structure implies).It also allows us to more easily break
services.py
up intoservices/base.py
andservices/gravatar.py
. That'll be good down the road, in case we want to add some other built-in services (github.py
,custom_url.py
, or whatever). -
Let's go into a little more detail on this, at the very least saying "avatar services," but ideally clarifying what this means more.
-
-
-
Similar comment to my other review. We should have a capital letter after the ":", since that's typically how errors will be represented (as another exception's message is often used as the "reason" for an error here).
We also usually have a form more like:
Could not register the avatar service %(item)s: This service is already registered.
Also, this one is missing a trailing period.
-
-
A property should generally have the same type as both the getter and setter. In this case, we're using a set value of a list, and a get of a generator. I feel consistency is preferable here, particularly since we're never going to really have more than one or two services enabled here.
-
-
-
Seeing a lot of inconsistency with the class paths in the docs. Some say
reviewboard.accounts.avatars.services
, somereviewboard.avatars.service
, and somereviewboard.avatars.services
. -
Might wrap better as:
raise ItemLookupError( '...' % service)
Same below.
Also, these should be localized.
-
I'm not sure it's clear what this really means, as written. Same below.
Can we say what saving means, or maybe rewrite it if it's something like "Whether or not the list of enabled services should be saved to the database"? "Registry" isn't necessarily as clear.
-
-
Not necessarily true. Maybe:
Whether the registry of avatars was newly populated by this call. If ``False``, the registry was already populated by a previosu call.
Also, do we use this anywhere? Might have missed it.
-
-
-
"set"/"unsetting" doesn't mean a lot outside of the internals of the registries, I don't think. Maybe we can reword this?
-
This is an internal detail I'd really rather not expose. It's cheap to fetch the
SiteConfiguration
, since we cache it, so let's just do that here. -
Since this is something that developers will be interacting with, this should go into a lot more detail on what this is responsible for, how it's used, and what's expected by an implementor.
-
-
-
-
"... to HTML."
This should go into more detail about how it's rendered (using
template
), and that it can be overridden for custom behavior. -
Let's cache these on the request, taking into account the user ID and size. This will give us a nice speed boost. We should also mention that in the docs.
-
-
-
This is kind of oddly written, and doesn't make it clear that
service_id
can impact this. This should be more explicit. -
-
Oh, also, I feel like this would be a great thing to have in Djblets, since avatars are a very generic concept.
-
Tool: Pyflakes Processed Files: reviewboard/accounts/avatars/tests.py reviewboard/accounts/avatars/registry.py reviewboard/admin/siteconfig.py reviewboard/accounts/avatars/services.py reviewboard/accounts/avatars/errors.py reviewboard/accounts/templatetags/avatars.py Ignored Files: reviewboard/accounts/avatars/__init__.py reviewboard/accounts/templatetags/__init__.py Tool: PEP8 Style Checker Processed Files: reviewboard/accounts/avatars/tests.py reviewboard/accounts/avatars/registry.py reviewboard/admin/siteconfig.py reviewboard/accounts/avatars/services.py reviewboard/accounts/avatars/errors.py reviewboard/accounts/templatetags/avatars.py Ignored Files: reviewboard/accounts/avatars/__init__.py reviewboard/accounts/templatetags/__init__.py
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Change Summary:
-
Move most of the registry to Djblets (https://reviews.reviewboard.org/r/7844/)
Address issues.
- Depends On:
-
Tool: Pyflakes Processed Files: reviewboard/admin/siteconfig.py reviewboard/avatars/__init__.py reviewboard/settings.py reviewboard/avatars/registry.py reviewboard/avatars/templatetags/avatars.py reviewboard/avatars/tests.py Ignored Files: reviewboard/avatars/templatetags/__init__.py Tool: PEP8 Style Checker Processed Files: reviewboard/admin/siteconfig.py reviewboard/avatars/__init__.py reviewboard/settings.py reviewboard/avatars/registry.py reviewboard/avatars/templatetags/avatars.py reviewboard/avatars/tests.py Ignored Files: reviewboard/avatars/templatetags/__init__.py
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
This needs more detail on what this does and how it works, for people not familiar with what we're doing.
-
This shouldn't have to be called here. It's already managed by the middleware and app initialize stuff, and when setting new configuration for the site. This should be able to rely on the existing calls.
-
-
Tool: Pyflakes Processed Files: reviewboard/admin/siteconfig.py reviewboard/avatars/__init__.py reviewboard/settings.py reviewboard/avatars/registry.py reviewboard/avatars/templatetags/avatars.py reviewboard/avatars/tests.py Ignored Files: reviewboard/avatars/templatetags/__init__.py Tool: PEP8 Style Checker Processed Files: reviewboard/admin/siteconfig.py reviewboard/avatars/__init__.py reviewboard/settings.py reviewboard/avatars/registry.py reviewboard/avatars/templatetags/avatars.py reviewboard/avatars/tests.py Ignored Files: reviewboard/avatars/templatetags/__init__.py
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Tool: Pyflakes Processed Files: reviewboard/admin/siteconfig.py reviewboard/avatars/__init__.py reviewboard/settings.py reviewboard/avatars/registry.py reviewboard/avatars/templatetags/avatars.py reviewboard/avatars/tests.py Ignored Files: reviewboard/avatars/templatetags/__init__.py Tool: PEP8 Style Checker Processed Files: reviewboard/admin/siteconfig.py reviewboard/avatars/__init__.py reviewboard/settings.py reviewboard/avatars/registry.py reviewboard/avatars/templatetags/avatars.py reviewboard/avatars/tests.py Ignored Files: reviewboard/avatars/templatetags/__init__.py
-
-
-
-