Revision: 6975 Author: nicdumz Date: 2009-06-21 10:18:11 +0000 (Sun, 21 Jun 2009)
Log Message: ----------- $Id$ can't be directly included in the code, it gets replaced by SVN of course...
Modified Paths: -------------- trunk/pywikipedia/version.py
Modified: trunk/pywikipedia/version.py =================================================================== --- trunk/pywikipedia/version.py 2009-06-21 09:30:53 UTC (rev 6974) +++ trunk/pywikipedia/version.py 2009-06-21 10:18:11 UTC (rev 6975) @@ -30,15 +30,17 @@ (tag, rev, date) = getversion_nightly() except Exception, e: import wikipedia - d = wikipedia.__version__.split(' ') + version = wikipedia.__version__ + if len(version) == 4: + # the value is most likely '$Id' + '$', it means that + # wikipedia.py got imported without using svn at all + cache = dict(tag='', rev='-1 (unknown)', date='0 (unknown)') + return cache + + d = version.split(' ') tag = '' - if d == '$Id$': - # wikipedia.py got imported without using svn - date = 'date unknown' - rev = '-1 (rev unknown)' - else: - date = time.strptime('T'.join(d[3:5]), '%Y-%m-%dT%H:%M:%SZ') - rev = d[2] + ' (wikipedia.py)' + date = time.strptime('T'.join(d[3:5]), '%Y-%m-%dT%H:%M:%SZ') + rev = d[2] + ' (wikipedia.py)' datestring = time.strftime('%b %d %Y, %H:%M:%S', date) cache = {'tag': tag, 'rev': rev, 'date': datestring} return cache
pywikipedia-svn@lists.wikimedia.org