Skip to content

Commit

Permalink
Adding the ability to configure TW within the config dictionary.
Browse files Browse the repository at this point in the history
  • Loading branch information
percious committed Oct 10, 2009
1 parent 9b27c41 commit 6a36f5b
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tg/configuration.py
Expand Up @@ -614,11 +614,15 @@ def add_tosca2_middleware(self, app):
"""
app = tw_middleware(app, {
'toscawidgets.framework.default_view': self.default_renderer,
'toscawidgets.framework.translator': ugettext,
'toscawidgets.middleware.inject_resources': True,
})

twconfig = {'toscawidgets.framework.default_view': self.default_renderer,
'toscawidgets.framework.translator': ugettext,
'toscawidgets.middleware.inject_resources': True,
}
for k,v in config.iteritems():
if k.startswith('toscawidgets.framework.') or k.startswith('toscawidgets.middleware.'):
twconfig[k] = v
app = tw_middleware(app, twconfig)
return app

def add_tosca2_middleware(self, app):
Expand Down Expand Up @@ -649,7 +653,6 @@ def add_tosca2_middleware(self, app):
option that is set within your application's ini file.)
"""
from tw2.core.middleware import Config, TwMiddleware

app = TwMiddleware(app,
default_engine=self.default_renderer,
translator=ugettext,
Expand Down

0 comments on commit 6a36f5b

Please sign in to comment.