mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-08-26 12:46:08 +00:00
Explictly close the file handle after reading a documentation page
This commit is contained in:
parent
dda4b930e0
commit
128ef20743
@ -36,10 +36,11 @@ def about(request):
|
|||||||
def helppage(request, page):
|
def helppage(request, page):
|
||||||
"""Serve a help page from the 'doc' directory"""
|
"""Serve a help page from the 'doc' directory"""
|
||||||
try:
|
try:
|
||||||
input_file = open(os.path.join('doc', '%s.part.html' % page), 'r')
|
with open(os.path.join('doc', '%s.part.html' % page), 'r') \
|
||||||
|
as input_file:
|
||||||
|
main = input_file.read()
|
||||||
except IOError:
|
except IOError:
|
||||||
raise Http404
|
raise Http404
|
||||||
main = input_file.read()
|
|
||||||
|
|
||||||
title = _('%s Documentation') % cfg.product_name
|
title = _('%s Documentation') % cfg.product_name
|
||||||
return TemplateResponse(request, 'base.html',
|
return TemplateResponse(request, 'base.html',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user