[Pywikipedia-l] SVN: [4668] trunk/pywikipedia/family.py

rotem at svn.wikimedia.org rotem at svn.wikimedia.org
Sun Dec 9 15:27:40 UTC 2007


Revision: 4668
Author:   rotem
Date:     2007-12-09 15:27:34 +0000 (Sun, 09 Dec 2007)

Log Message:
-----------
Make it possible not to add fallback default namespaces - custom namespaces don't need them. Do raise KeyError when the namespace doesn't exist for this language.

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

Modified: trunk/pywikipedia/family.py
===================================================================
--- trunk/pywikipedia/family.py	2007-12-09 15:15:18 UTC (rev 4667)
+++ trunk/pywikipedia/family.py	2007-12-09 15:27:34 UTC (rev 4668)
@@ -2397,10 +2397,10 @@
             raise KeyError('ERROR: Unknown namespace %d for %s:%s' % (ns_number, code, self.name))
         elif self.isNsI18N(ns_number, code):
             v = self.namespaces[ns_number][code]
-        elif fallback:
+        elif fallback and self.isNsI18N(ns_number, fallback):
             v = self.namespaces[ns_number][fallback]
         else:
-            raise KeyError('ERROR: title for namespace %d in language %s unknown' % (ns_number, code))  
+            raise KeyError('ERROR: title for namespace %d in language %s unknown' % (ns_number, code))
 
         if all:
             if type(v) is list:





More information about the Pywikipedia-l mailing list