forked from 0x2620/pandora
keys can be None
This commit is contained in:
parent
22beb05b5a
commit
773ab702e7
2 changed files with 6 additions and 2 deletions
|
@ -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())
|
||||||
|
|
|
@ -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 'url' in keys and 'url' in self.info:
|
|
||||||
data['url'] = self.info['url']
|
|
||||||
if keys:
|
if keys:
|
||||||
|
if 'url' in keys and 'url' in self.info:
|
||||||
|
data['url'] = self.info['url']
|
||||||
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]
|
||||||
|
|
Loading…
Reference in a new issue