| 40 | |
| 41 | ---- |
| 42 | |
| 43 | One more issue I have with this -- why is import done on every request as opposed to module load time? The following looks saner to me: |
| 44 | {{{ |
| 45 | #!python |
| 46 | from platform import architecture |
| 47 | |
| 48 | if architecture()[0] != '32bit': |
| 49 | raise Exception("Don't use this on non-32-bit platforms") |
| 50 | |
| 51 | # let ImportError propagate at module load time so that people can notice and fix it |
| 52 | import psyco |
| 53 | |
| 54 | class PsycoMiddleware(object): |
| 55 | """ |
| 56 | This middleware enables the psyco extension module which can massively |
| 57 | speed up the execution of any Python code. |
| 58 | """ |
| 59 | def process_request(self, request): |
| 60 | psyco.profile() |
| 61 | return None |
| 62 | }}} |