http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9529
Revision: 9529 Author: valhallasw Date: 2011-09-18 15:26:53 +0000 (Sun, 18 Sep 2011) Log Message: ----------- Two bugfixes for r9528: - added support for version numbers differing from 'x.y.z', eg '1.17wmf1' - fixed error message when there is no sign of the API
Modified Paths: -------------- trunk/pywikipedia/generate_family_file.py
Modified: trunk/pywikipedia/generate_family_file.py =================================================================== --- trunk/pywikipedia/generate_family_file.py 2011-09-18 15:19:02 UTC (rev 9528) +++ trunk/pywikipedia/generate_family_file.py 2011-09-18 15:26:53 UTC (rev 9529) @@ -17,7 +17,7 @@ import urllib2
from BeautifulSoup import BeautifulSoup -from distutils.version import StrictVersion as V +from distutils.version import LooseVersion as V
def urlopen(url): req = urllib2.Request(url, headers = {'User-agent': 'Pywikipedia family generator 0.1 - pywikipediabot.sf.net'}) @@ -219,6 +219,7 @@ REwgVersion = re.compile(ur'wgVersion ?= ?"([^"]*)"')
def __init__(self, fromurl): + self.fromurl = fromurl if fromurl.endswith("$1"): fromurl = fromurl[:-2] try: @@ -242,7 +243,7 @@
def _parse_pre_117(self, data): if not self.REwgEnableApi.search(data): - print "*** WARNING: Api does not seem to be enabled on %s" % fromurl + print "*** WARNING: Api does not seem to be enabled on %s" % self.fromurl try: self.version = self.REwgVersion.search(data).groups()[0] except AttributeError:
pywikipedia-svn@lists.wikimedia.org