From fc2e088ba144f2a5023fe8ee67c71117e109b770 Mon Sep 17 00:00:00 2001 From: Fabian Faessler Date: Sun, 29 Sep 2013 14:41:47 +0200 Subject: [PATCH] debug ip detection problem --- nsupdate/api/views.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/nsupdate/api/views.py b/nsupdate/api/views.py index 89581ba..04b2bde 100644 --- a/nsupdate/api/views.py +++ b/nsupdate/api/views.py @@ -22,16 +22,13 @@ def MyIpView(request): def DetectIpView(request, secret=None): - try: - s = SessionStore(session_key=secret) - except SessionStore.DoesNotExist: - s = request.session + s = SessionStore(session_key=secret) ipaddr = request.META['REMOTE_ADDR'] af = dns.inet.af_for_address(ipaddr) key = 'ipv4' if af == dns.inet.AF_INET else 'ipv6' s[key] = ipaddr - + s.save() with open(os.path.join(settings.STATIC_ROOT, "1px.gif"), "rb") as f: image_data = f.read() return HttpResponse(image_data, mimetype="image/png")