Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 1269:3816e2d6cf6e | 1270:c3424abf7f77 |
|---|---|
| 128 - *form*, the current CGI form information as a FieldStorage | 128 - *form*, the current CGI form information as a FieldStorage |
| 129 *config* | 129 *config* |
| 130 The current tracker config. | 130 The current tracker config. |
| 131 *db* | 131 *db* |
| 132 The current database, used to access arbitrary database items. | 132 The current database, used to access arbitrary database items. |
| 133 *utils* | |
| 134 This is a special class that has its base in the TemplatingUtils | |
| 135 class in this file. If the tracker interfaces module defines a | |
| 136 TemplatingUtils class then it is mixed in, overriding the methods | |
| 137 in the base class. | |
| 133 ''' | 138 ''' |
| 134 def getContext(self, client, classname, request): | 139 def getContext(self, client, classname, request): |
| 140 # construct the TemplatingUtils class | |
| 141 utils = TemplatingUtils | |
| 142 if hasattr(client.instance.interfaces, 'TemplatingUtils'): | |
| 143 class utils(client.instance.interfaces.TemplatingUtils, utils): | |
| 144 pass | |
| 145 | |
| 135 c = { | 146 c = { |
| 136 'options': {}, | 147 'options': {}, |
| 137 'nothing': None, | 148 'nothing': None, |
| 138 'request': request, | 149 'request': request, |
| 139 'db': HTMLDatabase(client), | 150 'db': HTMLDatabase(client), |
| 140 'config': client.instance.config, | 151 'config': client.instance.config, |
| 141 'tracker': client.instance, | 152 'tracker': client.instance, |
| 142 'utils': TemplatingUtils(client), | 153 'utils': utils(client), |
| 143 'templates': Templates(client.instance.config.TEMPLATES), | 154 'templates': Templates(client.instance.config.TEMPLATES), |
| 144 } | 155 } |
| 145 # add in the item if there is one | 156 # add in the item if there is one |
| 146 if client.nodeid: | 157 if client.nodeid: |
| 147 if classname == 'user': | 158 if classname == 'user': |
