From ac6c7d9f76849a1ff197e302bcf20f3c1686e0d3 Mon Sep 17 00:00:00 2001 From: bitmole Date: Wed, 21 Dec 2016 10:41:23 -0700 Subject: [PATCH 1/2] Add Jinja2 to dependency to setup. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 6abfb9b..9707c41 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ 'author_email': 'zedshaw@zedshaw.com', 'version': '1.0', 'scripts': ['bin/fuqit'], - 'install_requires': ['python-modargs', 'python-lust'], + 'install_requires': ['python-modargs', 'python-lust', 'jinja2'], 'packages': ['fuqit', 'fuqit.data'], 'name': 'fuqit' } From 4f0a19742ac60c61235a315a40a162913332161b Mon Sep 17 00:00:00 2001 From: bitmole Date: Wed, 21 Dec 2016 11:02:35 -0700 Subject: [PATCH 2/2] Add defaults for config module attributes. Avoid AttributeError when run with initial configuration. --- fuqit/web.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fuqit/web.py b/fuqit/web.py index 5a7b7a7..511ee8c 100644 --- a/fuqit/web.py +++ b/fuqit/web.py @@ -58,7 +58,7 @@ def process(method, path, params, context): def render_template(path, variables, ext=None): ext = ext or os.path.splitext(path)[1] - headers = tools.make_ctype(ext, config.default_mtype) + headers = tools.make_ctype(ext, config.__dict__.get('default_mtype', 'text/html')) if 'headers' in variables: sessions.load_session(variables) @@ -176,8 +176,8 @@ def configure(app_module="app", config_module="config"): config.app_path = os.path.realpath(app_module) config.errors_dir = config.app_path + '/errors/' config.env = Environment(loader=PackageLoader(config.app_module, '.')) - config.allowed_referer = re.compile(config.allowed_referer) + config.allowed_referer = re.compile(config.__dict__.get('allowed_referer', '.*')) config.static_dir = os.path.realpath(config.app_path + - (config.static_dir or '/static/')) + (config.__dict__.get('static_dir ', '/static/') ))