diff options
author | Christian Franke <nobody@nowhere.ws> | 2012-09-16 20:58:01 +0200 |
---|---|---|
committer | Christian Franke <nobody@nowhere.ws> | 2012-09-16 22:01:45 +0200 |
commit | 1c3c306f45f3e18cc0174cd1ea9cca36f37696dc (patch) | |
tree | bb67c4cc3b3d8d37237523ea5b26b4b345d82557 /scripts/template.py | |
parent | 722bde297e6ed7fb3978b8e785ffcbd6cd19d4f6 (diff) |
Add some stuff for the wiki
Diffstat (limited to 'scripts/template.py')
-rwxr-xr-x | scripts/template.py | 10 |
1 files changed, 7 insertions, 3 deletions
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 |