Mercurial > p > roundup > code
view roundup/cgi/engine_chameleon.py @ 7971:fe0348bbe45b
issue2551353 - Add roundup-classhelper for 2.4.0 release
Changes to the classic template are not done yet. Still testing.
This commit has document updates and changes to rest.py.
rest.py:
add /rest/data/user/role endpoint to core so the user doesn't have
to add the /rest/roles endpoint via interfaces.py. It will only send
roles for a user with Admin role and there is no way to override
this currently.
acknowledgements.txt:
Added members of team3 to other contributors. Specified for all
other contributes what they worked on.
upgrading.txt:
added classhelper section and basic template change
directions. Linked to admin_guide for full directions.
admin_guide.txt:
documented install, translation, troubleshooting, config etc.
user_guide.txt:
added section on using the classhelper. Added reference to section
earlier in the doc. Added image for section.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Tue, 21 May 2024 01:17:28 -0400 |
| parents | ac0802452818 |
| children | 310e19beba3e |
line wrap: on
line source
"""Templating engine adapter for the Chameleon.""" __docformat__ = 'restructuredtext' import chameleon from roundup.cgi.templating import context, TALLoaderBase from roundup.anypy.strings import s2u class Loader(TALLoaderBase): def __init__(self, template_dir): self.template_dir = template_dir self.loader = chameleon.PageTemplateLoader(template_dir) def load(self, tplname): src, filename = self._find(tplname) return RoundupPageTemplate(self.loader.load(src)) class RoundupPageTemplate(object): def __init__(self, pt): self._pt = pt def render(self, client, classname, request, **options): c = context(client, self, classname, request) c.update({'options': options}) def translate(msgid, domain=None, mapping=None, default=None): result = client.translator.translate(domain, msgid, mapping=mapping, default=default) return s2u(result) output = self._pt.render(None, translate, **c) return output.encode(client.charset) def __getitem__(self, name): return self._pt[name] def __getattr__(self, name): return getattr(self._pt, name)
