[Pywikipedia-svn] SVN: [7320] trunk/pywikipedia/wikipedia.py
filnik at svn.wikimedia.org
filnik at svn.wikimedia.org
Sat Sep 26 09:47:04 UTC 2009
Revision: 7320
Author: filnik
Date: 2009-09-26 09:47:03 +0000 (Sat, 26 Sep 2009)
Log Message:
-----------
Bugfix to the getTemplates() function
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2009-09-26 09:04:41 UTC (rev 7319)
+++ trunk/pywikipedia/wikipedia.py 2009-09-26 09:47:03 UTC (rev 7320)
@@ -954,8 +954,12 @@
tmpsFound = []
while True:
data = query.GetData(params, self.site(), encodeTitle = False)
- tmpsFound.extend([Page(self.site(), tmp['title'], defaultNamespace=tmp['ns'])
- for tmp in data['query']['pages'].values()[0] ])
+ pageid = data[u'query'][u'pages'].keys()[0]
+ try:
+ tmpsFound.extend([Page(self.site(), tmp['title'], defaultNamespace=tmp['ns'])
+ for tmp in data['query']['pages'][pageid].values()[0] ])
+ except TypeError:
+ pass
if data.has_key('query-continue'):
params["tlcontinue"] = data["query-continue"]["templates"]["tlcontinue"]
else:
More information about the Pywikipedia-svn
mailing list