keys can be None

This commit is contained in:
j 2016-09-26 10:56:32 +02:00
parent 22beb05b5a
commit 773ab702e7
2 changed files with 6 additions and 2 deletions

View file

@ -159,6 +159,10 @@ def init(request, data):
if 'HTTP_ACCEPT_LANGUAGE' in request.META: if 'HTTP_ACCEPT_LANGUAGE' in request.META:
response['data']['locale'] = request.META['HTTP_ACCEPT_LANGUAGE'].split(';')[0].split('-')[0] 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']['site'] = config
response['data']['user'] = init_user(request.user, request) response['data']['user'] = init_user(request.user, request)
request.session['last_init'] = str(datetime.now()) request.session['last_init'] = str(datetime.now())

View file

@ -422,9 +422,9 @@ class File(models.Model):
data[key] = self.info.get(key) data[key] = self.info.get(key)
data['users'] = list(set([i['user'] for i in data['instances']])) data['users'] = list(set([i['user'] for i in data['instances']]))
data['item'] = self.item.public_id data['item'] = self.item.public_id
if keys:
if 'url' in keys and 'url' in self.info: if 'url' in keys and 'url' in self.info:
data['url'] = self.info['url'] data['url'] = self.info['url']
if keys:
for k in list(data): for k in list(data):
if k not in keys: if k not in keys:
del data[k] del data[k]