Revision: 8318
Author:   xqt
Date:     2010-06-24 15:13:18 +0000 (Thu, 24 Jun 2010)

Log Message:
-----------
new method Page.isStaticRedirect(), needed for several requests (bug #3012516, 
bug #2685388, bug #2612266)

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py      2010-06-24 08:18:58 UTC (rev 8317)
+++ trunk/pywikipedia/wikipedia.py      2010-06-24 15:13:18 UTC (rev 8318)
@@ -1019,6 +1019,21 @@
             return False
         return False
 
+    def isStaticRedirect(self, force=False):
+        """Return True if this is a redirect containing the magic word
+        __STATICREDIRECT__, False if not or not existing."""
+        if self.isRedirectPage():
+            staticKeys = self.site().getmagicwords('staticredirect')
+            text = self.get(get_redirect=True, force=force)
+            if staticKeys:
+                found = False
+                for key in staticKeys:
+                    if key in text:
+                        found = True
+                        break
+                if found: return True
+        return False
+
     def isEmpty(self):
         """Return True if the page text has less than 4 characters.
 



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

Reply via email to