check data is a dict
This commit is contained in:
parent
6b1ce30eb2
commit
d241b90b63
4 changed files with 6 additions and 4 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue