Revision: 5038 Author: rotem Date: 2008-02-16 12:52:25 +0000 (Sat, 16 Feb 2008)
Log Message: ----------- Several fixes.
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-02-16 11:09:47 UTC (rev 5037) +++ trunk/pywikipedia/wikipedia.py 2008-02-16 12:52:25 UTC (rev 5038) @@ -2552,11 +2552,9 @@ redirectto = redirectto+"#"+section page2._getexception = IsRedirectPage page2._redirarg = redirectto - # There's no possibility to read the wpStarttime argument from the XML. - # It is this time that the MediaWiki software uses to check for edit - # conflicts. We take the earliest time later than the last edit, which - # seems to be the safest possible time. - page2._startTime = str(int(timestamp)+1) + # This is used for checking deletion conflict. + # Use the data loading time. + page2._startTime = time.strftime('%Y%m%d%H%M%S', time.gmtime()) if section: m = re.search(".3D_*(.27.27+)?(.5B.5B)?_*%s_*(.5B.5B)?(.27.27+)?_*.3D" % re.escape(section), sectionencode(text,page2.site().encoding())) if not m: @@ -4157,9 +4155,9 @@ output(u'NOTE: You have new messages in your sysop account on %s' % self) else: output(u'NOTE: You have new messages on %s' % self) - self._messages[index] = True - else: - self._messages[index] = False + self._messages[index] = True + else: + self._messages[index] = False
# Don't perform other checks if the data was already loaded if self._userData[index]:
Am Samstag 16 Februar 2008 13:52:25 schrieb rotem@svn.wikimedia.org:
Revision: 5038 --- trunk/pywikipedia/wikipedia.py 2008-02-16 11:09:47 UTC (rev 5037) +++ trunk/pywikipedia/wikipedia.py 2008-02-16 12:52:25 UTC (rev 5038)
- # There's no possibility to read the wpStarttime argument from the XML.
- # It is this time that the MediaWiki software uses to check for edit
- # conflicts. We take the earliest time later than the last edit, which
- # seems to be the safest possible time.
- page2._startTime = str(int(timestamp)+1)
- # This is used for checking deletion conflict.
- # Use the data loading time.
- page2._startTime = time.strftime('%Y%m%d%H%M%S', time.gmtime())
Hi Rotem,
Are you sure this is a good idea? I think this is potentially hazardous, as the bot will not cause edit conflicts (but instead just overwrite the latest change) when the local system time is not correct.
I think we had this local-time approach before, and Andre Engels found the better solution of using the last edit's timestamp.
Daniel
Daniel Herding wrote:
Am Samstag 16 Februar 2008 13:52:25 schrieb rotem@svn.wikimedia.org:
Revision: 5038 --- trunk/pywikipedia/wikipedia.py 2008-02-16 11:09:47 UTC (rev 5037) +++ trunk/pywikipedia/wikipedia.py 2008-02-16 12:52:25 UTC (rev 5038)
# There's no possibility to read the wpStarttime argument from the XML.
# It is this time that the MediaWiki software uses to check for edit
# conflicts. We take the earliest time later than the last edit, which
# seems to be the safest possible time.
page2._startTime = str(int(timestamp)+1)
# This is used for checking deletion conflict.
# Use the data loading time.
page2._startTime = time.strftime('%Y%m%d%H%M%S', time.gmtime())
Hi Rotem,
Are you sure this is a good idea? I think this is potentially hazardous, as the bot will not cause edit conflicts (but instead just overwrite the latest change) when the local system time is not correct.
I think we had this local-time approach before, and Andre Engels found the better solution of using the last edit's timestamp.
Daniel
The last edit's timestamp (+ 1 second) solution causes a deletion conflict for pages which were deleted and undeleted with no other edit afterwards. Since the starttime seems to be only used to check deletion conflicts (edittime is used to check edit conflicts), I think it is better to use the current time.
If the local clock is incorrect, it is possible that the bot won't be able to *edit* (creating pages shouldn't be affected, if edittime doesn't exist) lately-deleted pages (if the clock is too early), or that it will not raise deletion conflicts (if the clock is too late). I'm not sure if these problems are solvable, but it is better not to have problems with the type of pages I specified. It is obviously preferable to have the local clock exact.