forked from 0x2620/pandora
check data is a dict
This commit is contained in:
parent
6b1ce30eb2
commit
d241b90b63
4 changed files with 6 additions and 4 deletions
|
@ -210,7 +210,7 @@ def addMedia(request, data):
|
|||
else:
|
||||
extension = 'webm'
|
||||
f.selected = True
|
||||
if 'info' in data and data['info']:
|
||||
if 'info' in data and data['info'] and isinstance(data['info'], dict):
|
||||
f.info = data['info']
|
||||
f.info['extension'] = extension
|
||||
f.parse_info()
|
||||
|
|
|
@ -191,7 +191,7 @@ class Edit(models.Model):
|
|||
self.rightslevel = int(data['rightslevel'])
|
||||
if key == 'query' and not data['query']:
|
||||
setattr(self, key, {"static":True})
|
||||
elif key == 'query':
|
||||
elif key == 'query' and isinstance(data[key], dict):
|
||||
setattr(self, key, data[key])
|
||||
|
||||
if 'position' in data:
|
||||
|
|
|
@ -116,7 +116,7 @@ class List(models.Model):
|
|||
for key in data:
|
||||
if key == 'query' and not data['query']:
|
||||
setattr(self, key, {"static":True})
|
||||
elif key == 'query':
|
||||
elif key == 'query' and isinstance(data[key], dict):
|
||||
setattr(self, key, data[key])
|
||||
elif key == 'type':
|
||||
if data[key] == 'static':
|
||||
|
|
|
@ -116,7 +116,9 @@ class SessionData(models.Model):
|
|||
if data.ip.startswith('::ffff:'):
|
||||
data.ip = data.ip[len('::ffff:'):]
|
||||
data.useragent = request.META.get('HTTP_USER_AGENT', '')[:4096]
|
||||
data.info = json.loads(request.POST.get('data', '{}'))
|
||||
info = json.loads(request.POST.get('data', '{}'))
|
||||
if info and isinstance(info, dict):
|
||||
data.info = info
|
||||
screen = data.info.get('screen', {})
|
||||
if screen and 'height' in screen and 'width' in screen:
|
||||
data.screensize = u'%s\xd7%s' % (screen['width'], screen['height'])
|
||||
|
|
Loading…
Reference in a new issue