Mercurial > p > roundup > code
changeset 4584:760483ce731e
Fix override of TemplatingUtils in instance.py.
Thanks to Cheer Xiao for the patch.
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Mon, 30 Jan 2012 14:52:14 +0100 |
| parents | 1d1e0b729463 |
| children | 033a550812fc |
| files | CHANGES.txt roundup/cgi/templating.py roundup/instance.py |
| diffstat | 3 files changed, 7 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Thu Jan 26 15:42:04 2012 +0100 +++ b/CHANGES.txt Mon Jan 30 14:52:14 2012 +0100 @@ -73,6 +73,8 @@ Cheer Xiao for the patches. - Fix wrong execute permissions on some files, thanks to Cheer Xiao for the patch. +- Fix override of TemplatingUtils in instance.py, thanks to Cheer Xiao + for the patch. 2011-07-15: 1.4.19
--- a/roundup/cgi/templating.py Thu Jan 26 15:42:04 2012 +0100 +++ b/roundup/cgi/templating.py Mon Jan 30 14:52:14 2012 +0100 @@ -249,10 +249,9 @@ The current database, used to access arbitrary database items. *utils* - This is a special class that has its base in the TemplatingUtils - class in this file. If the tracker interfaces module defines a - TemplatingUtils class then it is mixed in, overriding the methods - in the base class. + This is an instance of client.instance.TemplatingUtils, which is + optionally defined in the tracker interfaces module and defaults to + TemplatingUtils class in this file. *templates* Access to all the tracker templates by name. @@ -272,12 +271,6 @@ methods ``gettext`` and ``ngettext``. """ - # construct the TemplatingUtils class - utils = TemplatingUtils - if (hasattr(client.instance, 'interfaces') and - hasattr(client.instance.interfaces, 'TemplatingUtils')): - class utils(client.instance.interfaces.TemplatingUtils, utils): - pass # if template, classname and/or request are not passed explicitely, # compute form client @@ -296,7 +289,7 @@ 'db': HTMLDatabase(client), 'config': client.instance.config, 'tracker': client.instance, - 'utils': utils(client), + 'utils': client.instance.TemplatingUtils(client), 'templates': client.instance.templates, 'template': template, 'true': 1,
--- a/roundup/instance.py Thu Jan 26 15:42:04 2012 +0100 +++ b/roundup/instance.py Mon Jan 30 14:52:14 2012 +0100 @@ -173,6 +173,7 @@ self._load_python('interfaces.py', vars) self.Client = vars.get('Client', client.Client) self.MailGW = vars.get('MailGW', mailgw.MailGW) + self.TemplatingUtils = vars.get('TemplatingUtils', templating.TemplatingUtils) def get_extensions(self, dirname): """Load python extensions
