Mercurial > p > roundup > code
comparison 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 |
comparison
equal
deleted
inserted
replaced
| 4583:1d1e0b729463 | 4584:760483ce731e |
|---|---|
| 247 | 247 |
| 248 *db* | 248 *db* |
| 249 The current database, used to access arbitrary database items. | 249 The current database, used to access arbitrary database items. |
| 250 | 250 |
| 251 *utils* | 251 *utils* |
| 252 This is a special class that has its base in the TemplatingUtils | 252 This is an instance of client.instance.TemplatingUtils, which is |
| 253 class in this file. If the tracker interfaces module defines a | 253 optionally defined in the tracker interfaces module and defaults to |
| 254 TemplatingUtils class then it is mixed in, overriding the methods | 254 TemplatingUtils class in this file. |
| 255 in the base class. | |
| 256 | 255 |
| 257 *templates* | 256 *templates* |
| 258 Access to all the tracker templates by name. | 257 Access to all the tracker templates by name. |
| 259 Used mainly in *use-macro* commands. | 258 Used mainly in *use-macro* commands. |
| 260 | 259 |
| 270 *i18n* | 269 *i18n* |
| 271 Internationalization service, providing string translation | 270 Internationalization service, providing string translation |
| 272 methods ``gettext`` and ``ngettext``. | 271 methods ``gettext`` and ``ngettext``. |
| 273 | 272 |
| 274 """ | 273 """ |
| 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 | |
| 281 | 274 |
| 282 # if template, classname and/or request are not passed explicitely, | 275 # if template, classname and/or request are not passed explicitely, |
| 283 # compute form client | 276 # compute form client |
| 284 if template is None: | 277 if template is None: |
| 285 template = client.template | 278 template = client.template |
| 294 'nothing': None, | 287 'nothing': None, |
| 295 'request': request, | 288 'request': request, |
| 296 'db': HTMLDatabase(client), | 289 'db': HTMLDatabase(client), |
| 297 'config': client.instance.config, | 290 'config': client.instance.config, |
| 298 'tracker': client.instance, | 291 'tracker': client.instance, |
| 299 'utils': utils(client), | 292 'utils': client.instance.TemplatingUtils(client), |
| 300 'templates': client.instance.templates, | 293 'templates': client.instance.templates, |
| 301 'template': template, | 294 'template': template, |
| 302 'true': 1, | 295 'true': 1, |
| 303 'false': 0, | 296 'false': 0, |
| 304 'i18n': client.translator | 297 'i18n': client.translator |
