Last modified: 2013-10-15 20:10:55 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T56995, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 54995 - [PATCH] Editing before getting the revisions of the page is causing a KeyError
[PATCH] Editing before getting the revisions of the page is causing a KeyError
Status: RESOLVED FIXED
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
unspecified
All All
: Unprioritized normal
: ---
Assigned To: Pywikipedia bugs
: easy, patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-04 22:51 UTC by Strainu
Modified: 2013-10-15 20:10 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Proposed patch (1021 bytes, patch)
2013-10-04 22:51 UTC, Strainu
Details

Description Strainu 2013-10-04 22:51:43 UTC
Created attachment 13438 [details]
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.
Comment 1 Strainu 2013-10-04 22:52:53 UTC
This is on core branch
Comment 2 Andre Klapper 2013-10-05 13:36:51 UTC
I'm curious if the Pywikibot maintainers would appreciate patches in Gerrit...
Comment 3 Gerrit Notification Bot 2013-10-06 22:23:01 UTC
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
Comment 4 Gerrit Notification Bot 2013-10-07 06:03:33 UTC
Change 87915 merged by Xqt:
Populate the revision dict if lastrev is not in it.

https://gerrit.wikimedia.org/r/87915

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links