Skip to content

Commit 0088b8f

Browse files
committed
Fix override of TemplatingUtils in instance.py.
Thanks to Cheer Xiao for the patch.
1 parent 3ab25ed commit 0088b8f

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

CHANGES.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ Fixed:
7373
Cheer Xiao for the patches.
7474
- Fix wrong execute permissions on some files, thanks to Cheer Xiao for
7575
the patch.
76+
- Fix override of TemplatingUtils in instance.py, thanks to Cheer Xiao
77+
for the patch.
7678

7779

7880
2011-07-15: 1.4.19

roundup/cgi/templating.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,9 @@ def context(client, template=None, classname=None, request=None):
249249
The current database, used to access arbitrary database items.
250250
251251
*utils*
252-
This is a special class that has its base in the TemplatingUtils
253-
class in this file. If the tracker interfaces module defines a
254-
TemplatingUtils class then it is mixed in, overriding the methods
255-
in the base class.
252+
This is an instance of client.instance.TemplatingUtils, which is
253+
optionally defined in the tracker interfaces module and defaults to
254+
TemplatingUtils class in this file.
256255
257256
*templates*
258257
Access to all the tracker templates by name.
@@ -272,12 +271,6 @@ class in this file. If the tracker interfaces module defines a
272271
methods ``gettext`` and ``ngettext``.
273272
274273
"""
275-
# construct the TemplatingUtils class
276-
utils = TemplatingUtils
277-
if (hasattr(client.instance, 'interfaces') and
278-
hasattr(client.instance.interfaces, 'TemplatingUtils')):
279-
class utils(client.instance.interfaces.TemplatingUtils, utils):
280-
pass
281274

282275
# if template, classname and/or request are not passed explicitely,
283276
# compute form client
@@ -296,7 +289,7 @@ class utils(client.instance.interfaces.TemplatingUtils, utils):
296289
'db': HTMLDatabase(client),
297290
'config': client.instance.config,
298291
'tracker': client.instance,
299-
'utils': utils(client),
292+
'utils': client.instance.TemplatingUtils(client),
300293
'templates': client.instance.templates,
301294
'template': template,
302295
'true': 1,

roundup/instance.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ def load_interfaces(self):
173173
self._load_python('interfaces.py', vars)
174174
self.Client = vars.get('Client', client.Client)
175175
self.MailGW = vars.get('MailGW', mailgw.MailGW)
176+
self.TemplatingUtils = vars.get('TemplatingUtils', templating.TemplatingUtils)
176177

177178
def get_extensions(self, dirname):
178179
"""Load python extensions

0 commit comments

Comments
 (0)