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

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Sat Dec 15 18:24:09 UTC 2007


Revision: 4716
Author:   rotem
Date:     2007-12-15 18:24:03 +0000 (Sat, 15 Dec 2007)

Log Message:
-----------
Fixing output when moving pages: data is empty when the move succeeds.

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2007-12-15 18:22:18 UTC (rev 4715)
+++ trunk/pywikipedia/wikipedia.py	2007-12-15 18:24:03 UTC (rev 4716)
@@ -1845,14 +1845,13 @@
             data = ''
         else:
             response, data = self.site().postForm(address, predata, sysop = sysop)
-        if data != u'':
-            if self.site().mediawiki_message('pagemovedsub') in data:
-                output(u'Page %s moved to %s' % (self.title(), newtitle))
-                return True
-            elif self.site().mediawiki_message('articleexists') in data:
+        if data == u'':
+            output(u'Page %s moved to %s' % (self.title(), newtitle))
+            return True
+        else:
+            if self.site().mediawiki_message('articleexists') in data:
                 output(u'Page moved failed: Target page [[%s]] already exists.'
                        % newtitle)
-                return False
             else:
                 output(u'Page move failed for unknown reason.')
                 try:
@@ -1865,7 +1864,7 @@
                     # otherwise, remove the irrelevant sections
                     data = data[ibegin:iend]
                 output(data)
-                return False
+            return False
 
     def delete(self, reason=None, prompt=True, throttle=True):
         """Deletes the page from the wiki.





More information about the Pywikipedia-l mailing list