catch case where .session_key was None, leading to an invalid /detectip/None url

This commit is contained in:
Thomas Waldmann 2013-11-15 01:16:13 +01:00
parent 117b34d4c9
commit 76d3dfebc2

View File

@ -54,4 +54,9 @@ def update_ips(request):
# kill the IP, it is not up-to-date any more # kill the IP, it is not up-to-date any more
# note: it is used to fill form fields, so set it to empty string # note: it is used to fill form fields, so set it to empty string
put_ip_into_session(s, '', kind=key) put_ip_into_session(s, '', kind=key)
if s.session_key is None:
# if we have a new session (== not loaded from database / storage), we
# MUST save it here to create its session_key as the base.html template
# uses .session_key to build the URL for detectip:
s.save()
return {} return {}