source: TI12-security/trunk/NDGSecurity/python/Tests/authtest/authtest/lib/template.py @ 7080

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/NDGSecurity/python/Tests/authtest/authtest/lib/template.py@7080
Revision 7080, 863 bytes checked in by pjkersha, 9 years ago (diff)
  • Property svn:keywords set to Id
Line 
1import pylons
2from pylons.templating import Buffet
3from pylons import config
4import authtest.lib.helpers as h
5import logging
6log = logging.getLogger(__name__)
7
8class MyBuffet(Buffet):
9    def _update_names(self, ns):
10        return ns
11
12def_eng = config['buffet.template_engines'][0]
13log.info("def_eng = %s" % def_eng)
14buffet = MyBuffet(
15    def_eng['engine'],
16    template_root=def_eng['template_root'],
17    **def_eng['template_options']
18)
19
20for e in config['buffet.template_engines'][1:]:
21    buffet.prepare(
22        e['engine'],
23        template_root=e['template_root'],
24        alias=e['alias'],
25        **e['template_options']
26    )
27
28class State:
29    pass
30
31c = State()
32c.openid = 'None'
33
34def make_template():
35    return buffet.render(
36        template_name="signin",
37        namespace=dict(h=h, c=State())
38    ).replace("%", "%%").replace("FORM_ACTION", "%s")
Note: See TracBrowser for help on using the repository browser.