diff options
author | Sean Finney <seanius@debian.org> | 2009-09-02 00:14:54 +0200 |
---|---|---|
committer | Sean Finney <seanius@debian.org> | 2009-09-02 00:14:54 +0200 |
commit | d45691869ccfb2c4bdb04d20d2a1c1abb8152373 (patch) | |
tree | 77ec4bc24c0aa3cef91549c9cf4ca438756a7196 | |
parent | a220af7b9d30e1b8ac005262c13e68a7a0bae5e6 (diff) | |
download | patch-tracker-d45691869ccfb2c4bdb04d20d2a1c1abb8152373.tar.gz |
move the profile/pstats import into run_profile
this way if the app is being run on a machine that does not have
python-profiler installed it will still function unless specifically
told to profile.
-rwxr-xr-x | pagehandler.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pagehandler.py b/pagehandler.py index 6298b45..99379db 100755 --- a/pagehandler.py +++ b/pagehandler.py @@ -24,6 +24,7 @@ def application(env, resp): return ReqHandler.ErrorCmd(str(e), e.status).output() def profile_app(call): + import cProfile as profile, pstats profile.run(call, "profile.out") p = pstats.Stats("profile.out") p.sort_stats('time', 'cumulative') @@ -35,7 +36,6 @@ if __name__ == '__main__': os.environ['SCRIPT_FILENAME'] = sys.argv[0] from wsgiref import simple_server as ss import getopt - import cProfile as profile, pstats def cmd_help(): print """ |