Fix incorrect copyright notice for Wikimedia images#2644
Fix incorrect copyright notice for Wikimedia images#2644jbh1996 wants to merge 8 commits intobartfeenstra:0.5.xfrom
Conversation
|
@jbh1996 Thanks for your PR! As you can see, some tests are failing. You can run these locally with What's the scope of this PR? To display this copyright information on the file pages? E.g. to fix #2583 ? |
|
@jbh1996 I noticed your Betty fork was made from Betty 0.4.x. Since then, the 0.5.x branch was created and all new development happens there (with bug fixes potentially backported to 0.4.x once fixed in 0.5.x). You'll want to make sure your local development branch is kept up to date with 0.5.x, or it'll end up diverging so much your Git changes can no longer be applied (preventing a PR merge). Let me know if you need help with something 👍 |
|
Hey Bart! I just got a chance to work on this again. I made some edits and the bin/fix is giving me no errors back. Let me know if there's still changes that need to be made to the pull request. Sorry this took me a bit to get to. |
|
@jbh1996 No worries, and take your time. Thanks for addressing the feedback and fixing the test failures. Your code looks good but we're now at the point where we need to do something with this new functionality, as well as write tests for it. In order to determine exactly what else needs to be done, is it #2583 you are trying to fix? If so (please confirm in a comment), then what remains is:
|
|
Yes it is #2583 that I'm trying to fix. I'll get into those files in the next few days to try to make this work. Thanks for your patience and pointers. |
|
I've made changes to both the copyright_notice and populator file for your review! |
| title: str | ||
| wikimedia_commons_url: str | ||
| name: str | ||
| image_copyright: Copyright | None |
There was a problem hiding this comment.
The class is called "image" already, so we can simply call the attribute "copyright".
| url=image.image_copyright.url, | ||
| ) | ||
| if image.image_copyright | ||
| else await WikipediaContributors.new_for_app(self._ancestry.app) |
There was a problem hiding this comment.
The original issue this PR tries to fix is that we are currently telling people these images are copyright Wikipedia contributors, but that is not the case (the images do not even come from Wikipedia). If we cannot get copyright information from Wikimedia, we should therefore let the image copyright be empty.
| links=links, | ||
| copyright_notice=self._copyright_notice, | ||
| copyright_notice=( | ||
| await WikimediaCommonsCopyright.new_for_app( |
There was a problem hiding this comment.
These factory methods exist so that code can instantiate classes without knowing what arguments their __init__() methods require, usually because the class name is not hardcoded. In this case we know the class name, so we can instantiate it without having to call .new_for_app().
This pull request creates the copyright class in the wiki client.py and updates the get_image function to populate it. It also edits the Image class to include a copyright attribute.