[Pywikipedia-l] SVN: [6252] trunk/pywikipedia/category_redirect.py

russblau at svn.wikimedia.org russblau at svn.wikimedia.org
Tue Jan 13 14:05:53 UTC 2009


Revision: 6252
Author:   russblau
Date:     2009-01-13 14:05:52 +0000 (Tue, 13 Jan 2009)

Log Message:
-----------
catch exceptions; sort log output

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

Modified: trunk/pywikipedia/category_redirect.py
===================================================================
--- trunk/pywikipedia/category_redirect.py	2009-01-13 13:38:39 UTC (rev 6251)
+++ trunk/pywikipedia/category_redirect.py	2009-01-13 14:05:52 UTC (rev 6252)
@@ -501,11 +501,16 @@
             if match.group(1):
                 # category redirect target starts with "Category:" - fix it
                 text = text[ :match.start(1)] + text[match.end(1): ]
-                cat.put(text,
-                        u"Robot: fixing category redirect parameter format")
-                self.log_text.append(
-                    u"* Removed category prefix from parameter in %s"
-                     % cat.aslink(textlink=True))
+                try:
+                    cat.put(text,
+                            u"Robot: fixing category redirect parameter format")
+                    self.log_text.append(
+                        u"* Removed category prefix from parameter in %s"
+                         % cat.aslink(textlink=True))
+                except wikipedia.Error:
+                    self.log_text.append(
+                        u"* Unable to save changes to %s"
+                         % cat.aslink(textlink=True))
 
         # delete record entries for non-existent categories
         for cat_name in list(record.keys()):
@@ -595,6 +600,7 @@
 
         wikipedia.setAction(wikipedia.translate(self.site.lang,
                                                 self.maint_comment))
+        self.log_text.sort()
         self.log_page.put(u"\n==%i-%02i-%02iT%02i:%02i:%02iZ==\n"
                             % time.gmtime()[:6]
                           + u"\n".join(self.log_text)





More information about the Pywikipedia-l mailing list