From b4a490901ad60ffa84d0b1ef76734deb1ed9a149 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 18 Sep 2018 23:05:34 +0200 Subject: [PATCH] python2.7 friendly --- pandora/archive/chop.py | 2 +- pandora/oxdjango/fields.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pandora/archive/chop.py b/pandora/archive/chop.py index 9738c9b5..75e36342 100644 --- a/pandora/archive/chop.py +++ b/pandora/archive/chop.py @@ -119,7 +119,7 @@ class Chop(object): self.keyframes = make_keyframe_index(video) return self.keyframes - def get_gop_sections(self, start: float, end: float) -> dict: + def get_gop_sections(self, start, end): keyframes = self.get_keyframes() start_pos = bisect_left(keyframes, start) end_pos = bisect_left(keyframes, end) diff --git a/pandora/oxdjango/fields.py b/pandora/oxdjango/fields.py index e4f4ae43..b9b1e58b 100644 --- a/pandora/oxdjango/fields.py +++ b/pandora/oxdjango/fields.py @@ -17,7 +17,7 @@ class JSONField(django.contrib.postgres.fields.JSONField): def __init__(self, *args, **kwargs): if 'encoder' not in kwargs: kwargs['encoder'] = DjangoJSONEncoder - super().__init__(*args, **kwargs) + super(JSONField, self).__init__(*args, **kwargs) def to_json(python_object): if isinstance(python_object, datetime.datetime): @@ -74,6 +74,8 @@ class DictField(models.TextField): except: raise Exception('failed to parse value: %s' % value) if value is not None: + if isinstance(value, string_types): + value = json.loads(value) assert isinstance(value, self._type) return value