New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add utilities for message schemas #108
Conversation
Codecov Report
@@ Coverage Diff @@
## master #108 +/- ##
==========================================
+ Coverage 96.99% 97.58% +0.59%
==========================================
Files 12 13 +1
Lines 1064 1077 +13
Branches 147 149 +2
==========================================
+ Hits 1032 1051 +19
+ Misses 22 17 -5
+ Partials 10 9 -1
Continue to review full report at Codecov.
|
fedora_messaging/schema_utils.py
Outdated
|
||
# https://github.com/fedora-infra/fedmsg_meta_fedora_infrastructure/issues/320 | ||
HARDCODED_AVATARS = { | ||
"bodhi": "https://apps.fedoraproject.org/img/icons/bodhi-{size}.png", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I think this should live in the base class of the application's message schema (or generally in their repository). I would not expect to look here when the hardcoded URL eventually breaks. Nor would I want to accept pull requests from applications adding their URLs here. What's your motivation for including it here rather than in the schema packages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nah you're right, I think I just stared at fedmsg code for too long, that's all.
return libravatar.libravatar_url( | ||
email=email, openid=openid, size=size, default=default | ||
) | ||
params = collections.OrderedDict([("s", size), ("d", default)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urlencode accepts plain dictionaries, why does this have to be an ordered dictionary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's only to make testing easier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding a comment to that effect to save confusion later.
8725018
to
a0814b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me. I didn't approve it just in case you want to add the docs here. I guess we should set up a label for mergify so we can approve PRs and just block the merge with a tag.
return libravatar.libravatar_url( | ||
email=email, openid=openid, size=size, default=default | ||
) | ||
params = collections.OrderedDict([("s", size), ("d", default)]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be worth adding a comment to that effect to save confusion later.
fedora_messaging/schema_utils.py
Outdated
from six.moves.urllib import parse | ||
|
||
try: | ||
import libravatar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When these APIs are added to the documentation (do you want to do that here or in a later PR?) it should probably note this optional dependency.
a0814b8
to
c0df7ce
Compare
Good point, I've added the docs now :-) |
At the moment it's mostly functions to generate avatar URLs. Signed-off-by: Aurélien Bompard <aurelien@bompard.org>
c0df7ce
to
4491ff4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
At the moment it's mostly functions to generate avatar URLs.