TypeError fix

(caused by different python versions: 2.7.3 vs 2.7.6)
remotes/origin/top_year_choice
Alexander Burdeiny 10 years ago
parent 1047c564ec
commit 8230a7d1e4
  1. 8
      functions/custom_fields.py

@ -273,7 +273,13 @@ class MonthMultiSelectField(models.CharField):
with TimeEncoding(locale) as encoding:
if not isinstance(cls._saved_month_names, list):
cls._saved_month_names = list(month_name)
return cls._saved_month_names[month_num].decode(encoding)
try:
# python 2.7.6
m = cls._saved_month_names[month_num].decode(encoding)
except (TypeError, ):
# python 2.7.3
m = cls._saved_month_names[month_num]
return m
@classmethod
def make_choice_display(cls, m, y):

Loading…
Cancel
Save