Example #1
0
 def display(self, *args, **kw):
     # Update the kwargs with the same values that are included in main templates
     # this allows us to access the following objects in widget templates:
     # ['tmpl_context', 'translator', 'session', 'ungettext', 'response', '_',
     #  'c', 'app_globals', 'g', 'url', 'h', 'request', 'helpers', 'N_', 'tg',
     #  'config']
     kw.update(_get_tg_vars())
     kw.update(pylons_globals())
     return forms.Widget.display(self, *args, **kw)
 def test_fallback_validation_context_in_templates(self):
     with test_context(None, '/'):
         vars = _get_tg_vars()
         assert vars.tg.errors == {}, vars.tg
         assert vars.tg.inputs == {}, vars.tg
Example #3
0
File: root.py Project: antsfee/tg2
 def get_tg_vars(self):
     return dict(tg_vars=list(_get_tg_vars().keys()))
Example #4
0
 def get_tg_vars(self):
     return dict(tg_vars=list(_get_tg_vars().keys()))
Example #5
0
 def test_fallback_validation_context_in_templates(self):
     with test_context(None, '/'):
         vars = _get_tg_vars()
         assert vars.tg.errors == {}, vars.tg
         assert vars.tg.inputs == {}, vars.tg