Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 2640:b01eca163779
The "type" parameter is supposed to be optional
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Tue, 27 Jul 2004 04:28:39 +0000 |
| parents | 11811b313459 |
| children | 1df7d4a41da4 |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Tue Jul 27 02:34:14 2004 +0000 +++ b/roundup/cgi/templating.py Tue Jul 27 04:28:39 2004 +0000 @@ -2252,6 +2252,14 @@ return Batch(self.client, self._sequence, self._size, self.end - self.overlap, 0, self.orphan, self.overlap) +class TemplatingUtil: + def __init__(self, utils, callable): + self.utils = utils + self.callable = callable + def __call__(self, *args, **kw): + args = (self.utils,)+args + return self.callable(*args, **kw) + class TemplatingUtils: ''' Utilities for templating ''' @@ -2269,4 +2277,13 @@ '''HTML-quote the supplied text.''' return cgi.escape(url) + def __getattr__(self, name): + '''Try the tracker's templating_utils.''' + if not hasattr(self.client.instance, 'templating_utils'): + # backwards-compatibility + raise AttributeError, name + if not self.client.instance.templating_utils.has_key(name): + raise AttributeError, name + return TemplatingUtil(self, self.client.instance.templating_utils[name]) + # vim: set et sts=4 sw=4 :
