Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1151

Show
Ignore:
Timestamp:
06/20/06 13:22:46
Author:
fumanchu
Message:

Fix for mp < 3.1 which didn't have apache.mpm_query.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cpmodpy.py

    r1150 r1151  
    5252        req.get_basic_auth_pw() 
    5353        request.login = req.user 
    54         # apache.mpm_query only became available in mod_python 3.1 
    55         request.multithread = bool(apache.mpm_query(apache.AP_MPMQ_IS_THREADED)) 
    56         request.multiprocess = bool(apache.mpm_query(apache.AP_MPMQ_IS_FORKED)) 
     54         
     55        try: 
     56            # apache.mpm_query only became available in mod_python 3.1 
     57            q = apache.mpm_query 
     58            threaded = q(apache.AP_MPMQ_IS_THREADED) 
     59            forked = q(apache.AP_MPMQ_IS_FORKED) 
     60        except AttributeError: 
     61            bad_value = ("You must provide a PythonOption '%s', " 
     62                         "either 'on' or 'off', when running a version " 
     63                         "of mod_python < 3.1") 
     64             
     65            threaded = options.get('multithread', '').lower() 
     66            if threaded == 'on': 
     67                threaded = True 
     68            elif threaded == 'off': 
     69                threaded = False 
     70            else: 
     71                raise ValueError(bad_value % "multithread") 
     72             
     73            forked = options.get('multiprocess', '').lower() 
     74            if forked == 'on': 
     75                forked = True 
     76            elif forked == 'off': 
     77                forked = False 
     78            else: 
     79                raise ValueError(bad_value % "multiprocess") 
     80        request.multithread = bool(threaded) 
     81        request.multiprocess = bool(forked) 
    5782         
    5883        # Run the CherryPy Request object and obtain the response 

Hosted by WebFaction

Log in as guest/cpguest to create tickets