"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "roundup/cgi/engine_chameleon.py" between
roundup-1.6.1.tar.gz and roundup-2.0.0.tar.gz

About: Roundup is an highly customisable issue-tracking system with command-line, web and e-mail interfaces (written in Python).

engine_chameleon.py  (roundup-1.6.1):engine_chameleon.py  (roundup-2.0.0)
"""Templating engine adapter for the Chameleon.""" """Templating engine adapter for the Chameleon."""
__docformat__ = 'restructuredtext' __docformat__ = 'restructuredtext'
import os.path
import chameleon import chameleon
from roundup.cgi.templating import StringIO, context, TALLoaderBase from roundup.cgi.templating import context, TALLoaderBase
from roundup.anypy.strings import s2u
class Loader(TALLoaderBase): class Loader(TALLoaderBase):
def __init__(self, dir): def __init__(self, dir):
self.dir = dir self.dir = dir
self.loader = chameleon.PageTemplateLoader(dir) self.loader = chameleon.PageTemplateLoader(dir)
def load(self, tplname): def load(self, tplname):
src, filename = self._find(tplname) src, filename = self._find(tplname)
return RoundupPageTemplate(self.loader.load(src)) return RoundupPageTemplate(self.loader.load(src))
class RoundupPageTemplate(object): class RoundupPageTemplate(object):
def __init__(self, pt): def __init__(self, pt):
self._pt = pt self._pt = pt
def render(self, client, classname, request, **options): def render(self, client, classname, request, **options):
c = context(client, self, classname, request) c = context(client, self, classname, request)
c.update({'options': options}) c.update({'options': options})
def translate(msgid, domain=None, mapping=None, default=None): def translate(msgid, domain=None, mapping=None, default=None):
result = client.translator.translate(domain, msgid, result = client.translator.translate(domain, msgid,
mapping=mapping, default=default) mapping=mapping,
return unicode(result, client.translator.OUTPUT_ENCODING) default=default)
return s2u(result)
output = self._pt.render(None, translate, **c) output = self._pt.render(None, translate, **c)
return output.encode(client.charset) return output.encode(client.charset)
def __getitem__(self, name): def __getitem__(self, name):
return self._pt[name] return self._pt[name]
def __getattr__(self, name): def __getattr__(self, name):
return getattr(self._pt, name) return getattr(self._pt, name)
 End of changes. 3 change blocks. 
4 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)