Skip to content
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

Merged
merged 1 commit into from Jan 15, 2019

Conversation

abompard
Copy link
Member

At the moment it's mostly functions to generate avatar URLs.

@abompard abompard requested a review from a team as a code owner December 13, 2018 18:43
@codecov-io
Copy link

codecov-io commented Dec 13, 2018

Codecov Report

Merging #108 into master will increase coverage by 0.59%.
The diff coverage is 100%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
fedora_messaging/schema_utils.py 100% <100%> (ø)
fedora_messaging/cli.py 97.22% <0%> (-0.04%) ⬇️
fedora_messaging/message.py 100% <0%> (+2.59%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 59560cc...4491ff4. Read the comment docs.


# https://github.com/fedora-infra/fedmsg_meta_fedora_infrastructure/issues/320
HARDCODED_AVATARS = {
"bodhi": "https://apps.fedoraproject.org/img/icons/bodhi-{size}.png",
Copy link
Member

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?

Copy link
Member Author

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.

fedora_messaging/schema_utils.py Outdated Show resolved Hide resolved
return libravatar.libravatar_url(
email=email, openid=openid, size=size, default=default
)
params = collections.OrderedDict([("s", size), ("d", default)])
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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 Show resolved Hide resolved
fedora_messaging/schema_utils.py Outdated Show resolved Hide resolved
@abompard abompard force-pushed the schema-utils branch 2 times, most recently from 8725018 to a0814b8 Compare December 19, 2018 17:38
Copy link
Member

@jeremycline jeremycline left a 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)])
Copy link
Member

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.

from six.moves.urllib import parse

try:
import libravatar
Copy link
Member

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.

@abompard
Copy link
Member Author

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>
Copy link
Member

@jeremycline jeremycline left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@mergify mergify bot merged commit f59e150 into fedora-infra:master Jan 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants