http://www.mediawiki.org/wiki/Special:Code/pywikipedia/10031
Revision: 10031 Author: valhallasw Date: 2012-03-21 17:22:56 +0000 (Wed, 21 Mar 2012) Log Message: ----------- Search compatibility for MW <= 1.16
http://www.mediawiki.org/wiki/Release_notes/1.16 : "Added fields to list=search output: size, wordcount, timestamp, snippet"
Original patch by K.-M. Hansche (loxley@users.sourceforge.net) Reference: pywikipediabot-Patches-3408799
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2012-03-21 17:10:58 UTC (rev 10030) +++ trunk/pywikipedia/wikipedia.py 2012-03-21 17:22:56 UTC (rev 10031) @@ -6095,7 +6095,10 @@ for s in data['search']: offset += 1 page = Page(self, s['title']) - yield page, s['snippet'], '', s['size'], s['wordcount'], s['timestamp'] + if self.versionnumber() >= 16: + yield page, s['snippet'], '', s['size'], s['wordcount'], s['timestamp'] + else: + yield page, '', '', '', '', '' else: #Yield search results (using Special:Search page) for query. throttle = True