From 1c3c306f45f3e18cc0174cd1ea9cca36f37696dc Mon Sep 17 00:00:00 2001 From: Christian Franke Date: Sun, 16 Sep 2012 20:58:01 +0200 Subject: Add some stuff for the wiki --- scripts/template.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts/template.py') diff --git a/scripts/template.py b/scripts/template.py index 2cfdf79..f6b073e 100755 --- a/scripts/template.py +++ b/scripts/template.py @@ -27,9 +27,11 @@ class Page: data = {"content.html":"", "keywords":"", "desc_de":"", "desc_en":""} for c in data: - f = open(os.path.join(pagepath, name, c), "r") - data[c] = f.read() - f.close + try: + with open(os.path.join(pagepath, name, c), "r") as f: + data[c] = f.read() + except Exception: + sys.excepthook(*sys.exc_info()) self._data = plugin.plugin_manager.process_content(data) @@ -104,6 +106,8 @@ if __name__ == '__main__': if __name__ == '__main__': for page in os.listdir(pagepath): + if page.endswith('_template'): + continue Page(page).render_and_save() if verbose: print "%s.html written" % page -- cgit v1.2.1