https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
Web browser: --- Bug ID: 54995 Summary: [PATCH] Editing before getting the revisions of the page is causing a KeyError Product: Pywikibot Version: unspecified Hardware: All OS: All Status: NEW Keywords: easy, patch Severity: normal Priority: Unprioritized Component: General Assignee: Pywikipedia-bugs@lists.wikimedia.org Reporter: crangasi2001@yahoo.com Classification: Unclassified Mobile Platform: ---
Created attachment 13438 --> https://bugzilla.wikimedia.org/attachment.cgi?id=13438&action=edit Proposed patch
I'm running https://code.google.com/p/wikiro/source/browse/trunk/robots/python/pywikiped... on ro.wp. The put function throws a KeyError:
Comuna Adâncata, Ialomița <<<
[[Comuna Adâncata, Ialomiţa]] doesn't exist Do you want to create a redirect? ([y]es, [N]o, [a]ll, [q]uit) y {} Traceback (most recent call last): File "pwb.py", line 58, in <module> execfile(sys.argv[0]) File "diacritice/diacritics_redirects.py", line 127, in <module> main() File "diacritice/diacritics_redirects.py", line 123, in main bot.run() File "diacritice/diacritics_redirects.py", line 50, in run self.treat(page) File "diacritice/diacritics_redirects.py", line 99, in treat page_mod.put(u"#%s [[%s]]" % (self.site.redirect(True), page_t.title()), comment) File "/home/andrei/pywikibot-core/pywikibot/page.py", line 872, in put async=async, callback=callback, **kwargs) File "/home/andrei/pywikibot-core/pywikibot/page.py", line 795, in save **kwargs) File "/home/andrei/pywikibot-core/pywikibot/page.py", line 804, in _save watch=watchval, bot=botflag, **kwargs) File "/home/andrei/pywikibot-core/pywikibot/site.py", line 709, in callee return fn(self, *args, **kwargs) File "/home/andrei/pywikibot-core/pywikibot/site.py", line 2636, in editpage params["basetimestamp"] = page._revisions[lastrev].timestamp KeyError: 4164884
The error is caused by the _revisions dict not being populated. Possible patch is attached.
https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
--- Comment #1 from Strainu crangasi2001@yahoo.com --- This is on core branch
https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
--- Comment #2 from Andre Klapper aklapper@wikimedia.org --- I'm curious if the Pywikibot maintainers would appreciate patches in Gerrit...
https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
--- Comment #3 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 87915 had a related patch set uploaded by Merlijn van Deen: Populate the revision dict if lastrev is not in it.
https://gerrit.wikimedia.org/r/87915
https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
Gerrit Notification Bot gerritadmin@wikimedia.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |PATCH_TO_REVIEW
https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
--- Comment #4 from Gerrit Notification Bot gerritadmin@wikimedia.org --- Change 87915 merged by Xqt: Populate the revision dict if lastrev is not in it.
https://gerrit.wikimedia.org/r/87915
https://bugzilla.wikimedia.org/show_bug.cgi?id=54995
Merlijn van Deen valhallasw@arctus.nl changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|PATCH_TO_REVIEW |RESOLVED CC| |valhallasw@arctus.nl Resolution|--- |FIXED
pywikipedia-bugs@lists.wikimedia.org