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

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Sat Dec 15 18:40:27 UTC 2007


Revision: 4718
Author:   rotem
Date:     2007-12-15 18:40:22 +0000 (Sat, 15 Dec 2007)

Log Message:
-----------
Some fixes.

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2007-12-15 18:25:58 UTC (rev 4717)
+++ trunk/pywikipedia/wikipedia.py	2007-12-15 18:40:22 UTC (rev 4718)
@@ -1842,7 +1842,7 @@
             predata['User-agent'] = useragent
             data = self.site().urlEncode(predata)
             response = urllib2.urlopen(urllib2.Request(self.site().protocol() + '://' + self.site().hostname() + address, data))
-            data = ''
+            data = u''
         else:
             response, data = self.site().postForm(address, predata, sysop = sysop)
         if data == u'':
@@ -1850,8 +1850,8 @@
             return True
         else:
             if self.site().mediawiki_message('articleexists') in data:
-                output(u'Page moved failed: Target page [[%s]] already exists.'
-                       % newtitle)
+                output(u'Page moved failed: Target page [[%s]] already exists.' % newtitle)
+                return False
             else:
                 output(u'Page move failed for unknown reason.')
                 try:
@@ -1864,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.
@@ -1911,10 +1911,10 @@
                 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())
+                    output(u'Deleted page %s' % self.aslink(forceInterwiki = True))
                     return True
                 else:
-                    output(u'Deletion of page %s failed:' % self.aslink())
+                    output(u'Deletion of page %s failed:' % self.aslink(forceInterwiki = True))
                     try:
                         ibegin = data.index('<!-- start content -->') + 22
                         iend = data.index('<!-- end content -->')
@@ -2084,7 +2084,7 @@
                 predata["User-agent"] = useragent
                 data = self.site().urlEncode(predata)
                 response = urllib2.urlopen(urllib2.Request(self.site().protocol() + '://' + self.site().hostname() + address, data))
-                data = ''
+                data = u''
             else:
                 data, response = self.site().postForm(address, predata, sysop = True)
 





More information about the Pywikipedia-l mailing list