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

purodha at svn.wikimedia.org purodha at svn.wikimedia.org
Tue Jan 20 13:55:52 UTC 2009


Revision: 6273
Author:   purodha
Date:     2009-01-20 13:55:52 +0000 (Tue, 20 Jan 2009)

Log Message:
-----------
Correct "missing attribute" error, hopefully.

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2009-01-19 22:59:18 UTC (rev 6272)
+++ trunk/pywikipedia/wikipedia.py	2009-01-20 13:55:52 UTC (rev 6273)
@@ -1092,15 +1092,18 @@
         if not self.isCategory():
             return False
         if not hasattr(self, "_catredirect"):
-            catredirs = self.site().category_redirects()
-            for (t, args) in self.templatesWithParams():
-                if t in catredirs:
-                    self._catredirect = True
-                    # Get target (first template argument)
-                    self._redirarg = self.site().namespace(14) + ":" + args[0]
-                    break
+            if not hasattr( self.site(), "category_redirects"):
+                self._catredirect = False
             else:
-                self._catredirect = False
+                catredirs = self.site().category_redirects()
+                for (t, args) in self.templatesWithParams():
+                    if t in catredirs:
+                        self._catredirect = True
+                        # Get target (first template argument)
+                        self._redirarg = self.site().namespace(14) + ":" + args[0]
+                        break
+                else:
+                    self._catredirect = False
         return self._catredirect
 
     def isDisambig(self):





More information about the Pywikipedia-l mailing list