Revision: 8830
Author:   valhallasw
Date:     2011-01-15 17:50:15 +0000 (Sat, 15 Jan 2011)
Log Message:
-----------
Bugfix for #3158464 "category.py add crashes on redirect"

Patch for the rewrite branch and backport to trunk.

Bug was introduced in r8493 when splitting off 'category.py add' into a
separate class. This patch resolves the bug.

Created during the Amsterdam Hackathon.

Modified Paths:
--------------
    branches/rewrite/scripts/category.py
    trunk/pywikipedia/category.py

Modified: branches/rewrite/scripts/category.py
===================================================================
--- branches/rewrite/scripts/category.py        2011-01-15 13:01:51 UTC (rev 
8829)
+++ branches/rewrite/scripts/category.py        2011-01-15 17:50:15 UTC (rev 
8830)
@@ -432,8 +432,8 @@
             else:
                 pywikibot.output(u"Page %s does not exist; skipping."
                                  % page.title(asLink=True))
-        except pywikibot.IsRedirectPage:
-            redirTarget = pywikibot.Page(site, arg.args[0])
+        except pywikibot.IsRedirectPage, arg:
+            redirTarget = pywikibot.Page(self.site, arg.args[0])
             pywikibot.output(u"WARNING: Page %s is a redirect to %s; skipping."
                              % (page.title(asLink=True),
                                 redirTarget.title(asLink=True)))

Modified: trunk/pywikipedia/category.py
===================================================================
--- trunk/pywikipedia/category.py       2011-01-15 13:01:51 UTC (rev 8829)
+++ trunk/pywikipedia/category.py       2011-01-15 17:50:15 UTC (rev 8830)
@@ -426,8 +426,8 @@
             else:
                 pywikibot.output(u"Page %s does not exist; skipping."
                                  % page.title(asLink=True))
-        except pywikibot.IsRedirectPage:
-            redirTarget = pywikibot.Page(site, arg.args[0])
+        except pywikibot.IsRedirectPage, arg:
+            redirTarget = pywikibot.Page(self.site, arg.args[0])
             pywikibot.output(u"WARNING: Page %s is a redirect to %s; skipping."
                              % (page.title(asLink=True),
                                 redirTarget.title(asLink=True)))


_______________________________________________
Pywikipedia-svn mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn

Reply via email to