DateHandler/_Date_fr.py : try to avoid negative dates conversion (B.C.E)

svn: r8944
This commit is contained in:
Jérôme Rapinat 2007-09-07 22:07:50 +00:00
parent 3ffc1a8af9
commit cf1ca2c224

View File

@ -213,7 +213,7 @@ class DateDisplayFR(DateDisplay):
if self.format == 0: if self.format == 0:
return self.display_iso(date_val) return self.display_iso(date_val)
elif self.format == 1: elif self.format == 1:
if date_val[3]: if date_val[2] < 0 or date_val[3]:
return self.display_iso(date_val) return self.display_iso(date_val)
else: else:
if date_val[0] == 0 and date_val[1] == 0: if date_val[0] == 0 and date_val[1] == 0:
@ -270,6 +270,23 @@ class DateDisplayFR(DateDisplay):
else: else:
return value return value
def _display_french(self, date_val):
year = date_val[2]
if date_val[0] == 0:
if date_val[1] == 0:
value = year
else:
value = u"%s %d" % (self.french[date_val[1]], year)
# convertion mistake before 22.9.1792
elif date_val[2] == 0 and date_val[1] == 13:
# from 17.9.1792 to 21.9.1792 : trap for Extra months, we cannot date back
return self._bce_str % year
# on 1792 before 22.9.1792, no negative years
elif date_val[2] < 0:
return self._bce_str % year
# valid dates on 1792
else:
return u"%s %s %d" % (date_val[0], self.french[date_val[1]], year)
def display(self, date): def display(self, date):
""" """