http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9722
Revision: 9722 Author: xqt Date: 2011-11-02 06:40:19 +0000 (Wed, 02 Nov 2011) Log Message: ----------- use abs() function
Modified Paths: -------------- trunk/pywikipedia/date.py
Modified: trunk/pywikipedia/date.py =================================================================== --- trunk/pywikipedia/date.py 2011-11-02 04:33:50 UTC (rev 9721) +++ trunk/pywikipedia/date.py 2011-11-02 06:40:19 UTC (rev 9722) @@ -1696,7 +1696,6 @@ 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 @@ -1766,10 +1765,7 @@
def formatYear(lang, year): - if year < 0: - return formats['YearBC'][lang](-year) - else: - return formats['YearAD'][lang](year) + return formats['YearBC'][lang](abs(year))
# # Map testing methods