From 8230a7d1e4e203340330a138e50806eea6991f09 Mon Sep 17 00:00:00 2001 From: Alexander Burdeiny Date: Sun, 1 May 2016 20:42:14 +0300 Subject: [PATCH] TypeError fix (caused by different python versions: 2.7.3 vs 2.7.6) --- functions/custom_fields.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/functions/custom_fields.py b/functions/custom_fields.py index 5fa4f1cb..ead09aa4 100644 --- a/functions/custom_fields.py +++ b/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):