Edgewall Software

Changes between Version 1 and Version 2 of TracDev/PluginDevelopment/ExtensionPoints/trac.web.chrome.ITemplateProvider


Ignore:
Timestamp:
Aug 21, 2011, 10:24:27 PM (8 years ago)
Author:
Peter Suter
Comment:

Replace example from Trac source with example completing ComponentModuleExamples

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/PluginDevelopment/ExtensionPoints/trac.web.chrome.ITemplateProvider

    v1 v2  
    3737== Examples ==
    3838
    39 [source:trunk/trac/versioncontrol/web_ui/main.py trac.versioncontrol.web_ui.main.VersionControlUI] provides no additional static resources and one additional directory with templates (used by other components in {{{trac.versioncontrol}}}): [source:trunk/trac/versioncontrol/templates trac.versioncontrol/templates/].
     39A minimal ITemplateProviderin isolation is not very useful (but possible) and usually accompanied by implementations of other interfaces that utilize the provided templates. Hence the following example is best understood in context of the ComponentModuleExamples.
     40
     41In Trac, components have no associated templates (besides the admin panels). The following example provides no additional static resources, but one additional `tempaltes` directory used by other components in the example `trac.component` package.
    4042
    4143{{{#!python
     
    4547from trac.web.chrome import ITemplateProvider
    4648
    47 class VersionControlUI(Component):
     49class ComponentModule(Component):
    4850
    4951    implements(ITemplateProvider)
     
    5557
    5658    def get_templates_dirs(self):
    57         return [pkg_resources.resource_filename('trac.versioncontrol',
     59        return [pkg_resources.resource_filename('trac.component',
    5860                                                'templates')]
    5961}}}