Webb Sprague
webb.sprague at gmail.com
Mon Sep 24 00:20:30 EDT 2007
(Sorry meant to reply to list.) Here is the error from http://blah/larry/lc/ListObjectsProfile, minus some personal stuff ;) MOD_PYTHON ERROR ProcessId: 31202 URI: '/larry/lc/ListObjectsProfile' Location: None PathInfo: '/ListObjectsProfile' Phase: 'PythonHandler' Handler: 'mod_python.publisher' Traceback (most recent call last): File "/usr/lib64/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch default=default_handler, arg=req, silent=hlist.silent) File "/usr/lib64/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target result = _execute_target(config, req, object, arg) File "/usr/lib64/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target result = object(arg) File "/usr/lib64/python2.5/site-packages/mod_python/publisher.py", line 213, in handler published = publish_object(req, object) File "/usr/lib64/python2.5/site-packages/mod_python/publisher.py", line 425, in publish_object return publish_object(req,util.apply_fs_data(object, req.form, req=req)) File "/usr/lib64/python2.5/site-packages/mod_python/util.py", line 554, in apply_fs_data return object(**args) File "/var/www/localhost/htdocs/larry/lc.py", line 82, in ListObjectsProfile return cProfile.run('ListObjects', '/tmp/ListObjectProf') File "/usr/lib64/python2.5/cProfile.py", line 29, in run prof = prof.run(statement) File "/usr/lib64/python2.5/cProfile.py", line 135, in run return self.runctx(cmd, dict, dict) File "/usr/lib64/python2.5/cProfile.py", line 140, in runctx exec cmd in globals, locals File "<string>", line 1, in <module> NameError: name 'ListObjects' is not defined On 9/23/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > Bouncing this back to list as reply-all not used. > > In what way does that not actually work? > > Graham > > On 24/09/2007, Webb Sprague <webb.sprague at gmail.com> wrote: > > Well, Graham, as usual you are an extremely prompt and helpful > > correspondent... but is there any way to do something like the > > following, which would work per call, giving a regular display and > > writing to a log (if it worked at all)? -- > > > > > > ListObjects = LcPageObjects.LcList(lcdb=lcdb, > > navTemplate=LARRYTEMPLATEDIR + > > '/Application.tmpl', > > objectListTemplate = > > LARRYTEMPLATEDIR + '/ObjectList.tmpl', > > title='LAR-E Object List') > > def ListObjectsProfile(): > > global ListObjects > > return cProfile.run('ListObjects()', '/tmp/ListObjectProf') > > > > Tx > > > > On 9/23/07, Graham Dumpleton <graham.dumpleton at gmail.com> wrote: > > > Presuming you are actually using mod_python.publisher as the URL > > > dispatcher, then instead of using: > > > > > > PythonHandler mod_python.publisher > > > > > > use: > > > > > > PythonHandler mymodule > > > > > > In your 'mymodule.py' then add: > > > > > > from mod_python import publisher > > > > > > def handler(req): > > > return publisher.handler(req) > > > > > > Once you have that working, then you can wrap the call to > > > publisher.handler() with what ever you want, including profiling > > > tools. > > > > > > Yes, this will also profile publisher's URL dispatch, but it is the > > > easiest place to insert it without having to do a bit of magic. > > > > > > Graham > > > > > > On 24/09/2007, Webb Sprague <webb.sprague at gmail.com> wrote: > > > > Could anyone help me think about the following problem? > > > > > > > > I have a handler, call it handler.py, in which I assign callable > > > > objects to variables, creating pages through the magic of URL mapping. > > > > For example: > > > > > > > > class Foo(object): > > > > def __init__(self, title): > > > > self.title = title > > > > > > > > def __call__(self, whatever): > > > > print "<title>" + title + "</title>" > > > > > > > > page1 = Foo('Title 1') > > > > page2 = Foo('Title 2') > > > > > > > > You can thus browse http://blah.com/handler/page1 and > > > > http://blah.com/handler/page2 > > > > > > > > I would like to profile everything from this handler page down, > > > > preferably with a single command like hotshot.profile_everything(...) > > > > near the top of handler.py. > > > > > > > > Can anyone describe how? > > > > > > > > Thanks, and let me know if I can submit more information. I haven't > > > > included the code because there is just so much of it... > > > > _______________________________________________ > > > > Mod_python mailing list > > > > Mod_python at modpython.org > > > > http://mailman.modpython.org/mailman/listinfo/mod_python > > > > > > > > > >
|