style fix: use with with open, os.path.join for pathes
This commit is contained in:
parent
26a911824d
commit
0a297b04ee
@ -24,7 +24,8 @@ def UpdateIpView(request):
|
||||
af = dns.inet.af_for_address(ipaddr)
|
||||
key = 'ipv4' if af == dns.inet.AF_INET else 'ipv6'
|
||||
request.session[key] = ipaddr
|
||||
image_data = open(os.path.join(settings.STATIC_ROOT, "1px.gif"), "rb").read()
|
||||
with open(os.path.join(settings.STATIC_ROOT, "1px.gif"), "rb") as f:
|
||||
image_data = f.read()
|
||||
return HttpResponse(image_data, mimetype="image/png")
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user