Changes between Version 3 and Version 4 of PsycoMiddleware


Ignore:
Timestamp:
Feb 23, 2007, 11:09:02 AM (17 years ago)
Author:
Mrts
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • PsycoMiddleware

    v3 v4  
    3838        return None
    3939}}}
     40
     41----
     42
     43One 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
     46from platform import architecture
     47
     48if 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
     52import psyco
     53
     54class 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}}}
Back to Top