diff --git a/nsupdate/api/views.py b/nsupdate/api/views.py index d3d94f2..9c605c0 100644 --- a/nsupdate/api/views.py +++ b/nsupdate/api/views.py @@ -14,10 +14,8 @@ def MyIpView(request): def UpdateIpView(request): ipaddr = request.META['REMOTE_ADDR'] af = dns.inet.af_for_address(ipaddr) - if af == dns.inet.AF_INET: - request.session['ipv4'] = ipaddr - else: - request.session['ipv6'] = ipaddr + key = 'ipv4' if af == dns.inet.AF_INET else 'ipv6' + request.session[key] = ipaddr return HttpResponse('OK', content_type="text/plain")