8257: Crash when mixed "inflected" and "non inflected" months
This commit is contained in:
parent
0643949cbf
commit
f67620dbfe
@ -424,22 +424,30 @@ class DateDisplay(object):
|
|||||||
_display_julian = _display_swedish = _display_gregorian
|
_display_julian = _display_swedish = _display_gregorian
|
||||||
|
|
||||||
def format_long_month_year(self, month, year, inflect, long_months):
|
def format_long_month_year(self, month, year, inflect, long_months):
|
||||||
|
if not hasattr(long_months[1], 'f'): # not a Lexeme: no inflection
|
||||||
|
return "{long_month} {year}".format(
|
||||||
|
long_month = long_months[month], year = year)
|
||||||
return self.FORMATS_long_month_year[inflect].format(
|
return self.FORMATS_long_month_year[inflect].format(
|
||||||
long_month = long_months[month],
|
long_month = long_months[month], year = year)
|
||||||
year = year)
|
|
||||||
|
|
||||||
def format_short_month_year(self, month, year, inflect, short_months):
|
def format_short_month_year(self, month, year, inflect, short_months):
|
||||||
|
if not hasattr(short_months[1], 'f'): # not a Lexeme: no inflection
|
||||||
|
return "{short_month} {year}".format(
|
||||||
|
short_month = short_months[month], year = year)
|
||||||
return self.FORMATS_short_month_year[inflect].format(
|
return self.FORMATS_short_month_year[inflect].format(
|
||||||
short_month = short_months[month],
|
short_month = short_months[month], year = year)
|
||||||
year = year)
|
|
||||||
|
|
||||||
def format_long_month(self, month, inflect, long_months):
|
def format_long_month(self, month, inflect, long_months):
|
||||||
|
if not hasattr(long_months[1], 'f'): # not a Lexeme: no inflection
|
||||||
|
return "{long_month}".format(long_month = long_months[month])
|
||||||
return self.FORMATS_long_month_year[inflect].format(
|
return self.FORMATS_long_month_year[inflect].format(
|
||||||
long_month = long_months[month], year = '').rstrip()
|
long_month = long_months[month], year = '').rstrip()
|
||||||
|
|
||||||
def format_short_month(self, month, inflect, short_months):
|
def format_short_month(self, month, inflect, short_months):
|
||||||
|
if not hasattr(short_months[1], 'f'): # not a Lexeme: no inflection
|
||||||
|
return "{short_month}".format(short_month = short_months[month])
|
||||||
return self.FORMATS_short_month_year[inflect].format(
|
return self.FORMATS_short_month_year[inflect].format(
|
||||||
short_month = short_months[month], year = '').rstrip()
|
short_month = short_months[month], year = '').rstrip()
|
||||||
|
|
||||||
def dd_dformat01(self, date_val):
|
def dd_dformat01(self, date_val):
|
||||||
"""
|
"""
|
||||||
@ -623,3 +631,4 @@ class DateDisplayEn(DateDisplay):
|
|||||||
|
|
||||||
display = DateDisplay.display_formatted
|
display = DateDisplay.display_formatted
|
||||||
|
|
||||||
|
_locale = _grampslocale.glocale # normally set in register_datehandler
|
||||||
|
Loading…
Reference in New Issue
Block a user