http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9008
Revision: 9008 Author: xqt Date: 2011-02-25 09:29:03 +0000 (Fri, 25 Feb 2011) Log Message: ----------- Check for edit conflict while reloading page during checking _editrestriction see http://da.wikipedia.org/w/index.php?title=Barack_Obama&action=historysub...
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2011-02-25 07:18:08 UTC (rev 9007) +++ trunk/pywikipedia/wikipedia.py 2011-02-25 09:29:03 UTC (rev 9008) @@ -1698,8 +1698,16 @@
# If there is an unchecked edit restriction, we need to load the page if self._editrestriction: - output(u'Page %s is semi-protected. Getting edit page to find out if we are allowed to edit.' % self.aslink()) - self.get(force = True, change_edit_time = False) + output( +u'Page %s is semi-protected. Getting edit page to find out if we are allowed to edit.' + % self.aslink()) + oldtime = self.editTime() + # Note: change_edit_time=True is always True since + # self.get() calls self._getEditPage without this parameter + self.get(force=True, change_edit_time=True) + newtime = self.editTime() + if oldtime != newtime: # page was changed + raise EditConflict(u'Page has been changed after first read.') self._editrestriction = False # If no comment is given for the change, use the default comment = comment or action
pywikipedia-svn@lists.wikimedia.org