Edgewall Software

Changes between Version 5 and Version 6 of TracPluggableModules


Ignore:
Timestamp:
Nov 19, 2004, 10:22:53 AM (19 years ago)
Author:
cboos@…
Comment:

Added a note about the timeline refactoring

Legend:

Unmodified
Added
Removed
Modified
  • TracPluggableModules

    v5 v6  
    3535There needs to be a central facility that manages the discovery and loading of plug-ins as well as the communication between them. We'll call this the {{{ModuleManager}}} for now.
    3636
    37 The module manager should probably be part of the environment, or in other words, for any environment their should be one module registry. Module discovery would presumably be based on a given paths (list of directories) that contain python modules. The registry class would find all classes that somehow identify themselves as Trac modules (for example by sub-classing a central {{{Module}}} class, or by defining some module-scope variable). There could also be a 'plugins' folder in Trac environments that would be added the path by default.
     37The module manager should probably be part of the environment, or in other words, for any environment their should be one module registry. Module discovery would presumably be based on a given paths (list of directories) that contain python modules. The registry class would find all classes that somehow identify themselves as Trac modules (for example by sub-classing a central {{{Module}}} class, or by defining some module-scope variable). There could also be a 'plugins' folder in Trac environments that would be added the path by default.
    3838
    3939''An alternative and possibly more efficient but also more cumbersome approach would be to require the user to specify the "fully qualified" name of every additional module, for example in TracIni. Modules such as the timeline would be in the list by default, but could be disabled by removing them.''
     
    6060}}}
    6161
    62 In an environment such as [wiki:TracStandalone tracd] or [wiki:TracModPython mod_python], the {{{process}}} method might be called concurrently on the same module object, so module implementations should not store request-specific data as instance variables, but rather pass such data through as parameters to other methods.
     62In an environment such as [wiki:TracStandalone tracd] or [wiki:TracModPython mod_python], the {{{process}}} method might be called concurrently on the same module object, so module implementations should not store request-specific data as instance variables, but rather pass such data through as parameters to other methods.
    6363
    64 ''Renaming the current "{{{render}}}" to "{{{process}}}" here simply because the latter sounds more appropriate.'''
     64''Renaming the current "{{{render}}}" to "{{{process}}}" here simply because the latter sounds more appropriate.'''
    6565
    6666== Module Cooperation ==
     
    8686The wiki module would contribute to the timeline simply by appropriately implementing these functions. Same for any other module that wants to put events in the timeline.
    8787
    88 The timeline module would use a convenience function in the {{{Module}}} base class to collect the events from all available plug-ins. That might look like the following:
     88The timeline module would use a convenience function in the {{{Module}}} base class to collect the events from all available plug-ins. That might look like the following:
    8989
    9090{{{
     
    9797
    9898A couple of drawbacks become visible here:
    99  * The current timeline code is very efficient by basically consisting of a single SQL query over all the related tables. Under the plug-in model, we'd have at least one query per contributing module.
    100  * Similarly, ordering of the events will need to be done in Python in the timeline module after it has collected all events.
     99 * The current timeline code is very efficient by basically consisting of a single SQL query over all the related tables. Under the plug-in model, we'd have at least one query per contributing module. ''Not necessarily: each contributing module could contribute the appropriate SQL fragment for the query, as well as a post-processing routine. The current timeline code could be easily refactored  that way, without loosing its efficiency.''
     100 * Similarly, ordering of the events will need to be done in Python in the timeline module after it has collected all events. ''See above.''
    101101
    102102This is probably just the price to pay for a cleaner architecture, but optimizations may be possible.
     
    114114Comments, alternative approaches, constructive criticism, etc. Bring it on!
    115115--ChristopherLenz
     116
    116117
    117118