[mod_python] Profiling mod_python with callables?

Webb Sprague webb.sprague at gmail.com
Mon Sep 24 19:40:08 EDT 2007


Here is the final thing that works, with both the unprofiled basic
function and the profiled version.

### List all of the objects within the navigation/Application template
ListObjects = LcPageObjects.LcList(lcdb=lcdb,
                                   navTemplate=LARRYTEMPLATEDIR +
'/Application.tmpl',
                                   objectListTemplate =
LARRYTEMPLATEDIR + '/ObjectList.tmpl',
                                   title='LAR-E Object List')
def ListObjectsProfile(req):
    ## runs above function through profiler.  Don't know what repeated
calls do to the file yet..
    ## need two step return, or get error
    ret = cProfile.runctx('ListObjects(req)', globals(), locals(),
filename='/tmp/ListObjectProf')
    return ret

(Very helpful stuff from Graham snipped...)


More information about the Mod_python mailing list