safer check for requestviewer conf key

This commit is contained in:
Alfredo Deza
2011-06-24 20:16:32 -04:00
parent 2b9723b399
commit 9db5baece5

View File

@@ -39,9 +39,8 @@ def make_app(root, static_root=None, debug=False, errorcfg={}, wrap_app=None, lo
app = Cascade([StaticURLParser(static_root), app])
if isinstance(logging, dict) or logging == True:
app = TransLogger(app, **(isinstance(logging, dict) and logging or {}))
if conf.requestviewer:
if hasattr(conf, 'requestviewer'):
existing_hooks = kw.get('hooks', [])
if RequestViewerHook not in existing_hooks:
existing_hooks.append(RequestViewerHook(conf.requestviewer.as_dict()))
kw['hooks'] = existing_hooks
existing_hooks.append(RequestViewerHook(conf.requestviewer.as_dict()))
kw['hooks'] = existing_hooks
return app