From 773ab702e74bc57626fcf2476ead5cb719458d97 Mon Sep 17 00:00:00 2001 From: j Date: Mon, 26 Sep 2016 10:56:32 +0200 Subject: [PATCH] keys can be None --- pandora/app/views.py | 4 ++++ pandora/archive/models.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pandora/app/views.py b/pandora/app/views.py index f6343d74..9fbff09c 100644 --- a/pandora/app/views.py +++ b/pandora/app/views.py @@ -159,6 +159,10 @@ def init(request, data): if 'HTTP_ACCEPT_LANGUAGE' in request.META: response['data']['locale'] = request.META['HTTP_ACCEPT_LANGUAGE'].split(';')[0].split('-')[0] + + if request.META.get('HTTP_X_PREFIX') == 'NO': + config['site']['videoprefix'] = '' + config['site']['mediaprefix'] = '' response['data']['site'] = config response['data']['user'] = init_user(request.user, request) request.session['last_init'] = str(datetime.now()) diff --git a/pandora/archive/models.py b/pandora/archive/models.py index 7b3c97c0..5897503d 100644 --- a/pandora/archive/models.py +++ b/pandora/archive/models.py @@ -422,9 +422,9 @@ class File(models.Model): data[key] = self.info.get(key) data['users'] = list(set([i['user'] for i in data['instances']])) data['item'] = self.item.public_id - if 'url' in keys and 'url' in self.info: - data['url'] = self.info['url'] if keys: + if 'url' in keys and 'url' in self.info: + data['url'] = self.info['url'] for k in list(data): if k not in keys: del data[k]