Changeset 93
- Timestamp:
- 06/07/06 01:09:49
- Files:
-
- modpython_gateway.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modpython_gateway.py
r41 r93 19 19 PythonOption SCRIPT_NAME /mcontrol 20 20 21 Some WSGI applications need to be cleaned up when Apache exits. You can 22 register a cleanup handler with yet another PythonOption directive: 23 24 PythonOption wsgi.cleanup module::function 25 26 The module.function will be called with no arguments on server shutdown, 27 once for each child process or thread. 21 28 """ 22 29 … … 164 171 165 172 173 cleanup = None 174 166 175 def handler(req): 176 # Register a cleanup function if requested. 177 global cleanup 178 if not cleanup: 179 func = req.get_options().get('wsgi.cleanup') 180 if func: 181 module_name, object_str = func.split('::', 1) 182 module = __import__(module_name, globals(), locals(), ['']) 183 object = apache.resolve_object(module, object_str) 184 def cleaner(data): 185 object() 186 apache.register_cleanup(cleaner) 187 167 188 # Import the wsgi 'application' callable and pass it to Handler.run 168 189 modname, objname = req.get_options()['wsgi.application'].split('::', 1)
