Bugs item #3092329, was opened at 2010-10-21 21:26 Message generated for change (Tracker Item Submitted) made by drtrigon You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3092329...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dr. Trigon (drtrigon) Assigned to: Nobody/Anonymous (nobody) Summary: KeyError in userlib.User.contributions
Initial Comment: Hello all
This error occured to me during a try to get contributions of user IWorld:
Traceback (most recent call last): File "sum_disc.py", line 1288, in <module> main() File "sum_disc.py", line 1284, in main bot.run() File "sum_disc.py", line 341, in run self.checkRecentEdits() File "sum_disc.py", line 566, in checkRecentEdits usersumList = [p[0].title() for p in self._user.contributions(limit = count)] File "/data/toolserver/pywikipedia/userlib.py", line 299, in contributions contrib['revid'], ts, contrib['comment'] KeyError: 'comment'
The content of contrib:
{u'pageid': 5698070, u'title': u'Wikipedia:Vandalismusmeldung', u'timestamp': u'2010-10-20T11:58:45Z', u'revid': 80498587, u'user': u'IWorld', u'ns': 4, u'commenthidden': u''}
As you can see the 'comment' item is missing, but a 'commenthidden' is present. I wrote a patch to take this into account. I decided to return an u'' instead of contrib['comment'] in such a case, since in this place an unicode string is expected and thus a None or drop this item is not a good idea.
Please have a look to the attached patch.
Greetings!
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=3092329...
pywikipedia-bugs@lists.wikimedia.org