diff options
author | Eric Naeseth <enaeseth@gmail.com> | 2010-01-17 06:54:37 +0800 |
---|---|---|
committer | Chris Wanstrath <chris@ozmm.org> | 2010-02-09 18:35:26 +0800 |
commit | db1b35ccb21f70f698c1c9387d533f01358f0f04 (patch) | |
tree | c082676bea06aab88a0a542a3234765da5004fe9 | |
parent | 112ac76d615bd7051daeaabc170298a854d4c0f1 (diff) | |
download | pystache-db1b35ccb21f70f698c1c9387d533f01358f0f04.tar.gz |
Helping to ensure the template file gets closed.
-rw-r--r-- | pystache/view.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pystache/view.py b/pystache/view.py index bbed285..15c6942 100644 --- a/pystache/view.py +++ b/pystache/view.py @@ -55,8 +55,10 @@ class View(object): self.template_file = os.path.join(self.template_path, name) f = open(self.template_file, 'r') - template = f.read() - f.close() + try: + template = f.read() + finally: + f.close() return template def get_template_name(self, name=None): |