comparison MoinMoin/themes/__init__.py @ 104:9ca492c52070

use default theme if we cannot get the one that was requested (instead of crashing)
author MattMaker <trip@entropyreductionservices.com>
date Fri, 11 Mar 2011 23:08:35 -0600
parents 5b156d90317f
children ddc707d70d9d
comparison
equal deleted inserted replaced
64:5b156d90317f 104:9ca492c52070
29 u = getattr(flaskg, 'user', None) 29 u = getattr(flaskg, 'user', None)
30 if u and u.theme_name is not None: 30 if u and u.theme_name is not None:
31 theme_name = u.theme_name 31 theme_name = u.theme_name
32 else: 32 else:
33 theme_name = app.cfg.theme_default 33 theme_name = app.cfg.theme_default
34 return get_theme(theme_name) 34 try:
35 return get_theme(theme_name)
36 except KeyError:
37 logging.warning("theme %s was not found; using default of %s instead." % (theme_name,app.cfg.theme_default))
38 theme_name = app.cfg.theme_default
39 return get_theme(theme_name)
40
35 41
36 42
37 def render_template(template, **context): 43 def render_template(template, **context):
38 flaskg.clock.start('render_template') 44 flaskg.clock.start('render_template')
39 output = render_theme_template(get_current_theme(), template, **context) 45 output = render_theme_template(get_current_theme(), template, **context)