http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9723
Revision: 9723 Author: xqt Date: 2011-11-02 12:18:32 +0000 (Wed, 02 Nov 2011) Log Message: ----------- revert r9722
Modified Paths: -------------- trunk/pywikipedia/date.py
Modified: trunk/pywikipedia/date.py =================================================================== --- trunk/pywikipedia/date.py 2011-11-02 06:40:19 UTC (rev 9722) +++ trunk/pywikipedia/date.py 2011-11-02 12:18:32 UTC (rev 9723) @@ -1696,6 +1696,7 @@ formatLimits = { 'MonthName' : (lambda v: 1 <=v and v < 13, 1, 13), 'Number' : (lambda v: 0 <=v and v < 1000000, 0, 1001), + 'YearAD' : (lambda v: 0 <=v and v < 2501, 0, 2501), 'YearBC' : (lambda v: 0 <=v and v < 4001, 0, 501), # zh: has years as old as 前1700年 'DecadeAD' : (lambda v: 0 <=v and v < 2501, 0, 2501), # At some point need to re-add "and v%10==0" to the limitation @@ -1765,7 +1766,10 @@
def formatYear(lang, year): - return formats['YearBC'][lang](abs(year)) + if year < 0: + return formats['YearBC'][lang](-year) + else: + return formats['YearAD'][lang](year)
# # Map testing methods
pywikipedia-svn@lists.wikimedia.org