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

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Sat Dec 15 18:45:20 UTC 2007


Revision: 4719
Author:   rotem
Date:     2007-12-15 18:45:14 +0000 (Sat, 15 Dec 2007)

Log Message:
-----------
Detecting sysop form of 'could not move article - target exists', and detecting 'could not delete - doesn't exist'.

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2007-12-15 18:40:22 UTC (rev 4718)
+++ trunk/pywikipedia/wikipedia.py	2007-12-15 18:45:14 UTC (rev 4719)
@@ -1849,7 +1849,7 @@
             output(u'Page %s moved to %s' % (self.title(), newtitle))
             return True
         else:
-            if self.site().mediawiki_message('articleexists') in data:
+            if self.site().mediawiki_message('articleexists') in data or self.site().mediawiki_message('delete_and_move') in data:
                 output(u'Page moved failed: Target page [[%s]] already exists.' % newtitle)
                 return False
             else:
@@ -1911,10 +1911,13 @@
                 response, data = self.site().postForm(address, predata, sysop = True)
             if data:
                 if self.site().mediawiki_message('actioncomplete') in data:
-                    output(u'Deleted page %s' % self.aslink(forceInterwiki = True))
+                    output(u'Page %s deleted' % self.aslink(forceInterwiki = True))
                     return True
+                elif self.site().mediawiki_message('cannotdelete') in data:
+                    output(u'Page %s could not be deleted - it doesn\'t exist' % self.aslink(forceInterwiki = True))
+                    return False
                 else:
-                    output(u'Deletion of page %s failed:' % self.aslink(forceInterwiki = True))
+                    output(u'Deletion of %s failed for an unknown reason. The response text is:' % self.aslink(forceInterwiki = True))
                     try:
                         ibegin = data.index('<!-- start content -->') + 22
                         iend = data.index('<!-- end content -->')





More information about the Pywikipedia-l mailing list