[Pywikipedia-l] SVN: [5330] trunk/pywikipedia/wikipedia.py

wikipedian at svn.wikimedia.org wikipedian at svn.wikimedia.org
Thu May 8 00:07:39 UTC 2008


Revision: 5330
Author:   wikipedian
Date:     2008-05-08 00:07:39 +0000 (Thu, 08 May 2008)

Log Message:
-----------
IMPORTANT update: read and send the revisionId, which is required for the Flagged Revisions 
extension that is now activated on the German Wikipedia.

If you run a bot that edits pages on de: (e. g. an interwiki bot), this update is mandatory. 
Please update immediately, otherwise your bot might be in danger of getting blocked.

Modified Paths:
--------------
    trunk/pywikipedia/wikipedia.py

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2008-05-07 23:56:38 UTC (rev 5329)
+++ trunk/pywikipedia/wikipedia.py	2008-05-08 00:07:39 UTC (rev 5330)
@@ -442,6 +442,8 @@
             self._userName = None
             self._ipedit = None
             self._editTime = None
+            # For the Flagged Revisions MediaWiki extension
+            self._revisionId = None
             self._deletedRevs = None
         except NoSuchSite:
             raise
@@ -746,6 +748,9 @@
             self.moveRestriction = m.group(1);
         else:
             self.moveRestriction = ''
+        m = re.search('name=["\']baseRevId["\'] type=["\']hidden["\'] value="(\d+)"', text)
+        if m:
+            self._revisionId = m.group(1)
         if change_edit_time:
             # Get timestamps
             m = re.search('value="(\d+)" name=["\']wpEdittime["\']', text)
@@ -1280,6 +1285,8 @@
         else:
             predata['wpEdittime'] = self._editTime
             predata['wpStarttime'] = self._startTime
+        if self._revisionId:
+            predata['baseRevId'] = self._revisionId
         # Pass the minorEdit and watchArticle arguments to the Wiki.
         if minorEdit:
             predata['wpMinoredit'] = '1'
@@ -2653,6 +2660,8 @@
         text = entry.text
         editRestriction = entry.editRestriction
         moveRestriction = entry.moveRestriction
+        revisionId = entry.revisionid
+
         page = Page(self.site, title)
         successful = False
         for page2 in self.pages:
@@ -2665,6 +2674,7 @@
                     page2._permalink = entry.revisionid
                     page2._userName = username
                     page2._ipedit = ipedit
+                    page2._revisionId = revisionId
                     page2._editTime = timestamp
                     section = page2.section()
                     m = self.site.redirectRegex().match(text)





More information about the Pywikipedia-l mailing list