From 128ef207432324cc1f71dffd7c83cc45ea787b83 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Sun, 17 Aug 2014 19:22:02 +0530 Subject: [PATCH] Explictly close the file handle after reading a documentation page --- modules/help/help.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/help/help.py b/modules/help/help.py index c3bfb53aa..7657558af 100644 --- a/modules/help/help.py +++ b/modules/help/help.py @@ -36,10 +36,11 @@ def about(request): def helppage(request, page): """Serve a help page from the 'doc' directory""" 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: raise Http404 - main = input_file.read() title = _('%s Documentation') % cfg.product_name return TemplateResponse(request, 'base.html',