diff roundup/cgi/templating.py @ 1270:c3424abf7f77

added ability to implement new templating utility methods
author Richard Jones <richard@users.sourceforge.net>
date Fri, 11 Oct 2002 01:26:43 +0000
parents db1ae414f363
children cae50587fb96
line wrap: on
line diff
--- a/roundup/cgi/templating.py	Fri Oct 11 01:26:05 2002 +0000
+++ b/roundup/cgi/templating.py	Fri Oct 11 01:26:43 2002 +0000
@@ -130,8 +130,19 @@
           The current tracker config.
         *db*
           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.
     '''
     def getContext(self, client, classname, request):
+        # construct the TemplatingUtils class
+        utils = TemplatingUtils
+        if hasattr(client.instance.interfaces, 'TemplatingUtils'):
+            class utils(client.instance.interfaces.TemplatingUtils, utils):
+                pass
+
         c = {
              'options': {},
              'nothing': None,
@@ -139,7 +150,7 @@
              'db': HTMLDatabase(client),
              'config': client.instance.config,
              'tracker': client.instance,
-             'utils': TemplatingUtils(client),
+             'utils': utils(client),
              'templates': Templates(client.instance.config.TEMPLATES),
         }
         # add in the item if there is one

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