Changeset 540
- Timestamp:
- 05/11/2008 10:01:42 PM (2 months ago)
- Files:
-
- ape/trunk/ape/commandline.py (modified) (1 diff)
- ape/trunk/ape/engine.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
ape/trunk/ape/commandline.py
r537 r540 159 159 options, args = parser.parse_args(args) 160 160 161 wrapped = cls.trigger_startup_listeners 162 def wrapper(self): 163 for name, option in ape.Option.registry.iteritems(): 164 optparse_option = _to_optparse_option(app.config, option) 165 parser.add_option(optparse_option) 166 167 options, args = parser.parse_args(argv[1:]) 168 return wrapped(self) 169 cls.trigger_startup_listeners = wrapper 170 161 171 app = cls( 162 application_name=name, config_file=options.config, defer_startup=True,172 config_file=options.config, application_name=name, defer_startup=True, 163 173 logging_uri=options.logging, debug=options.debug, **kwargs 164 174 ) 165 175 166 for name, option in ape.Option.registry.iteritems():167 optparse_option = _to_optparse_option(app.config, option)168 parser.add_option(optparse_option)169 170 options, args = parser.parse_args(argv[1:])171 176 if not defer_startup: 172 177 app.startup() ape/trunk/ape/engine.py
r539 r540 58 58 59 59 # Class defaults 60 entry_point_name = None 60 61 application_name = None 61 62 config_file = None … … 63 64 _active_engine = None 64 65 65 def __init__(self, application_name=None, config_file=None,66 def __init__(self, config_file=None, application_name=None, 66 67 defer_startup=False, logging_uri=None, debug=None): 67 68 """Construct a new Engine. … … 97 98 self.log.debug('APE: Starting %s', self.application_name) 98 99 self.load_plugins(plugin_paths=self.plugin_paths) 100 self.trigger_startup_listeners() 101 Engine._active_engine = self 102 103 def trigger_startup_listeners(self): 104 """Call startup listeners. 105 106 Mostly useful for hooking into startup process. 107 """ 99 108 for listener in self.lifecycle_listeners: 100 109 listener.engine_startup() 101 Engine._active_engine = self102 110 103 111 def shutdown(self): … … 116 124 """Load all Agate plugins registered through setuptools.""" 117 125 if entry_point_name is None: 118 entry_point_name = self. application_name + '.plugins'126 entry_point_name = self.entry_point_name 119 127 if plugin_paths is None: 120 plugin_paths = []128 plugin_paths = self.plugin_paths 121 129 122 130 distributions, errors = pkg_resources.working_set.find_plugins(
