Contact: fumanchu@aminus.org

Log in as guest/misc to create tickets

Changeset 106

Show
Ignore:
Timestamp:
08/18/06 22:16:00
Author:
fumanchu
Message:

modpython_gateway: fixed bug in cleanup and added a "wsgi.startup" PythonOption? that works similarly (but gets passed the request object).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modpython_gateway.py

    r95 r106  
    171171 
    172172 
     173startup = None 
    173174cleanup = None 
    174175 
    175176def handler(req): 
     177    # Run a startup function if requested. 
     178    global startup 
     179    if not startup: 
     180        func = req.get_options().get('wsgi.startup') 
     181        if func: 
     182            module_name, object_str = func.split('::', 1) 
     183            module = __import__(module_name, globals(), locals(), ['']) 
     184            startup = apache.resolve_object(module, object_str) 
     185            startup(req) 
     186     
    176187    # Register a cleanup function if requested. 
    177188    global cleanup 
     
    181192            module_name, object_str = func.split('::', 1) 
    182193            module = __import__(module_name, globals(), locals(), ['']) 
    183             object = apache.resolve_object(module, object_str) 
     194            cleanup = apache.resolve_object(module, object_str) 
    184195            def cleaner(data): 
    185                 object() 
     196                cleanup() 
    186197            try: 
    187198                # apache.register_cleanup wasn't available until 3.1.4.