From c712e5813a4bc8f47f2d79f532d8ead5edc720c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?syst=C3=A8me?= Date: Sat, 14 Jan 2017 13:47:07 +0100 Subject: [PATCH] 9824 9899: revert changes done for avoiding span and range errors handling seems incomplete, need a translator-reviewer --- gramps/gen/datehandler/_date_sr.py | 38 +++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/gramps/gen/datehandler/_date_sr.py b/gramps/gen/datehandler/_date_sr.py index c50d6bbdc..11cf16096 100644 --- a/gramps/gen/datehandler/_date_sr.py +++ b/gramps/gen/datehandler/_date_sr.py @@ -296,7 +296,43 @@ class DateDisplaySR_Base(DateDisplay): else: return value - display = DateDisplay.display_formatted + def display(self, date): + """ + Return a text string representing the date. + """ + mod = date.get_modifier() + cal = date.get_calendar() + qual = date.get_quality() + start = date.get_start_date() + newyear = date.get_new_year() + + qual_str = self._qual_str[qual] + span1 = self._span1 + span2 = self._span2 + range1 = self._range1 + range2 = self._range2 + + if mod == Date.MOD_TEXTONLY: + return date.get_text() + elif start == Date.EMPTY: + return "" + elif mod == Date.MOD_SPAN: + d_1 = self.display_cal[cal](start) + d_2 = self.display_cal[cal](date.get_stop_date()) + scal = self.format_extras(cal, newyear) + return "%s%s %s %s %s%s" % (qual_str, span1, d_1, span2, d_2, + scal) + elif mod == Date.MOD_RANGE: + d_1 = self.display_cal[cal](start) + d_2 = self.display_cal[cal](date.get_stop_date()) + scal = self.format_extras(cal, newyear) + return "%s%s %s %s %s%s" % (qual_str, range1, d_1, range2, d_2, + scal) + else: + text = self.display_cal[date.get_calendar()](start) + scal = self.format_extras(cal, newyear) + return "%s%s%s%s" % (qual_str, self._mod_str[mod], text, + scal) class DateDisplaySR_Latin(DateDisplaySR_Base): """