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: [email protected]
Reporter: [email protected]
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/pywikipedia/diacritice/diacritics_redirects.py
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l