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

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Sat Dec 15 13:06:27 UTC 2007


Revision: 4713
Author:   rotem
Date:     2007-12-15 13:06:21 +0000 (Sat, 15 Dec 2007)

Log Message:
-----------
Raise an exception when creating an ImagePage that is not in the image namespace.

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

Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py	2007-12-15 12:50:08 UTC (rev 4712)
+++ trunk/pywikipedia/wikipedia.py	2007-12-15 13:06:21 UTC (rev 4713)
@@ -2220,8 +2220,9 @@
 
     """
     def __init__(self, site, title, insite = None):
-        # TODO: raise an exception if title is not in Image: namespace
         Page.__init__(self, site, title, insite, defaultNamespace=6)
+        if self.namespace() != 6:
+            raise ValueError(u'BUG: %s is not in the image namespace!' % title)
         self._imagePageHtml = None
 
     def getImagePageHtml(self):





More information about the Pywikipedia-l mailing list