diff roundup/cgi/templating.py @ 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 528fe0a3af24
children a2eb4fb3e6d8
line wrap: on
line diff
--- 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,

Roundup Issue Tracker: http://roundup-tracker.org/