| 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) |
|---|