Mercurial > piecrust2
comparison piecrust/plugins/base.py @ 7:343d08ef5668
More PieCrust 3 fixes, and a couple of miscellaneous bug fixes.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 16 Aug 2014 15:07:22 -0700 |
parents | f485ba500df3 |
children | 5dbab01daaba |
comparison
equal
deleted
inserted
replaced
6:f5ca5c5bed85 | 7:343d08ef5668 |
---|---|
103 plugin.initialize(self.app) | 103 plugin.initialize(self.app) |
104 | 104 |
105 def _loadPlugin(self, plugin_dir): | 105 def _loadPlugin(self, plugin_dir): |
106 pass | 106 pass |
107 | 107 |
108 def _getPluginComponents(self, name, initialize=False, order_cmp=None, order_key=None): | 108 def _getPluginComponents(self, name, initialize=False, order_key=None): |
109 if name in self._componentCache: | 109 if name in self._componentCache: |
110 return self._componentCache[name] | 110 return self._componentCache[name] |
111 | 111 |
112 all_components = [] | 112 all_components = [] |
113 for plugin in self.plugins: | 113 for plugin in self.plugins: |
115 all_components += plugin_components | 115 all_components += plugin_components |
116 if initialize: | 116 if initialize: |
117 for comp in plugin_components: | 117 for comp in plugin_components: |
118 comp.initialize(self.app) | 118 comp.initialize(self.app) |
119 | 119 |
120 if order_cmp is not None or order_key is not None: | 120 if order_key is not None: |
121 all_components.sort(cmp=order_cmp, key=order_key) | 121 all_components.sort(key=order_key) |
122 | 122 |
123 self._componentCache[name] = all_components | 123 self._componentCache[name] = all_components |
124 return all_components | 124 return all_components |
125 | 125 |