5293: return year only with 'about' calculation

svn: r18294
This commit is contained in:
Jérôme Rapinat 2011-10-12 14:42:54 +00:00
parent d03186f36b
commit 6dbab99330

View File

@ -313,7 +313,8 @@ class Span(object):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("age|about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("age|about") + " " + self._format((year, 0 ,0))
elif (self.date2.get_modifier() == Date.MOD_RANGE or elif (self.date2.get_modifier() == Date.MOD_RANGE or
self.date2.get_modifier() == Date.MOD_SPAN): self.date2.get_modifier() == Date.MOD_SPAN):
start, stop = self.date2.get_start_stop_range() start, stop = self.date2.get_start_stop_range()
@ -335,7 +336,7 @@ class Span(object):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.BEFORE) #self.sort = (v, -Span.BEFORE)
#self.minmax = (v, v + Span.BEFORE) #self.minmax = (v, v + Span.BEFORE)
self.repr = _("more than") + " " + self._format(self._diff(self.date1, self.date2)) self.repr = _("more than about") + " " + self._format(self._diff(self.date1, self.date2))
elif self.date2.get_modifier() == Date.MOD_AFTER: elif self.date2.get_modifier() == Date.MOD_AFTER:
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.AFTER) #self.sort = (v, -Span.AFTER)
@ -345,7 +346,8 @@ class Span(object):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("age|about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("age|about") + " " + self._format((year, 0 ,0))
elif (self.date2.get_modifier() == Date.MOD_RANGE or elif (self.date2.get_modifier() == Date.MOD_RANGE or
self.date2.get_modifier() == Date.MOD_SPAN): self.date2.get_modifier() == Date.MOD_SPAN):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
@ -372,7 +374,8 @@ class Span(object):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.AFTER) #self.minmax = (v - Span.ABOUT, v + Span.AFTER)
self.repr = _("more than about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("more than about") + " " + self._format((year, 0 ,0))
elif (self.date2.get_modifier() == Date.MOD_RANGE or elif (self.date2.get_modifier() == Date.MOD_RANGE or
self.date2.get_modifier() == Date.MOD_SPAN): self.date2.get_modifier() == Date.MOD_SPAN):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
@ -384,28 +387,33 @@ class Span(object):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("age|about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = (self._diff(self.date1, self.date2))
self.repr = _("age|about") + " " + self._format((year, 0 ,0))
elif self.date2.get_modifier() == Date.MOD_BEFORE: elif self.date2.get_modifier() == Date.MOD_BEFORE:
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.BEFORE) #self.sort = (v, -Span.BEFORE)
#self.minmax = (v - Span.BEFORE, v + Span.ABOUT) #self.minmax = (v - Span.BEFORE, v + Span.ABOUT)
self.repr = _("more than") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("more than") + " " + self._format((year, 0 ,0))
elif self.date2.get_modifier() == Date.MOD_AFTER: elif self.date2.get_modifier() == Date.MOD_AFTER:
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, Span.AFTER) #self.sort = (v, Span.AFTER)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("less than about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("less than about") + " " + self._format((year, 0 ,0))
elif self.date2.get_modifier() == Date.MOD_ABOUT: elif self.date2.get_modifier() == Date.MOD_ABOUT:
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("age|about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("age|about") + " " + self._format((year, 0 ,0))
elif (self.date2.get_modifier() == Date.MOD_RANGE or elif (self.date2.get_modifier() == Date.MOD_RANGE or
self.date2.get_modifier() == Date.MOD_SPAN): self.date2.get_modifier() == Date.MOD_SPAN):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("age|about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("age|about") + " " + self._format((year, 0 ,0))
elif (self.date1.get_modifier() == Date.MOD_RANGE or elif (self.date1.get_modifier() == Date.MOD_RANGE or
self.date1.get_modifier() == Date.MOD_SPAN): # SPAN---------------------------- self.date1.get_modifier() == Date.MOD_SPAN): # SPAN----------------------------
if self.date2.get_modifier() == Date.MOD_NONE: if self.date2.get_modifier() == Date.MOD_NONE:
@ -432,7 +440,8 @@ class Span(object):
#v = self.date1.sortval - self.date2.sortval #v = self.date1.sortval - self.date2.sortval
#self.sort = (v, -Span.ABOUT) #self.sort = (v, -Span.ABOUT)
#self.minmax = (v - Span.ABOUT, v + Span.ABOUT) #self.minmax = (v - Span.ABOUT, v + Span.ABOUT)
self.repr = _("age|about") + " " + self._format(self._diff(self.date1, self.date2)) (year, month, day) = self._diff(self.date1, self.date2)
self.repr = _("age|about") + " " + self._format((year, 0 ,0))
elif (self.date2.get_modifier() == Date.MOD_RANGE or elif (self.date2.get_modifier() == Date.MOD_RANGE or
self.date2.get_modifier() == Date.MOD_SPAN): self.date2.get_modifier() == Date.MOD_SPAN):
start1, stop1 = self.date1.get_start_stop_range() start1, stop1 = self.date1.get_start_stop_range()