On 30 December 2012 23:31, Bináris <wikipo...@gmail.com> wrote: > The code in wikipedia.py is: > elif self.comment() and username in self.comment(): > raise LockedPage( > u'Not allowed to edit %s because last edit maybe > reverted' > % self.title(asLink=True)) > (line 1970)
It was added by xql in r10769: http://svn.wikimedia.org/viewvc/pywikipedia/trunk/pywikipedia/wikipedia.py?revision=10769&view=markup (you can find this yourself using the 'annotate' function in the repository browser.... or svn blame, but that takes ages) Basically, I think there are two ways of improving this, as the basic idea of preventing reverts makes sense to me: a) using a less crude method to determine reverts of ourself - can't we detect the last revision's owner? I think that's p.userName()? b) using a different exception - one that more clearly signifies 'don't edit without user intervention' - on the other hand, that's sort of what LockedPage does! It tells the code: hey, you can only edit this with another user. > Of course, these type of messages in the argument of raise won't appear on > user's screen, it is hidden into the source code. For some reason, Python > does not show the message in user exceptions. I cannot reproduce this: >>> raise wikipedia.LockedPage('something') Traceback (most recent call last): File "<stdin>", line 1, in <module> pywikibot.exceptions.LockedPage: something but maybe the exception was caught and rethrown without message (which would be the real wrongdo-er!) > > This was my first experience with this kind of error so I was first > frightened and confused and finally found out that I should use a force=True > parameter, and so after waiting another 8 minutes I could save the page. I > solved the case and lost 15-20 minutes. Good to hear you have solved the problem - and sorry that it wasted that much time. But please also take from this that you should be prepared for exceptions when saving - you want to handle the exceptions in a sensible way, so the bot doesn't crash, wasting your time :-) Anyway, I'd like xqt to make a note on this, so that we know the background of the original commit. I think the basic goals are OK, but maybe the implementation can use some improvements. Merlijn _______________________________________________ Pywikipedia-l mailing list Pywikipedia-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l