Skip to content

Commit

Permalink
The Control_Panel/DebugInfo/manage_profile ZMI view fixes were
Browse files Browse the repository at this point in the history
accumulating successive prints of stats.
  • Loading branch information
rpatterson committed Nov 18, 2010
1 parent 7c6f7af commit 5260f10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/App/ApplicationManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import os
import sys
import time
from cStringIO import StringIO

from AccessControl.requestmethod import requestmethod
from AccessControl.SecurityManagement import getSecurityManager
Expand Down Expand Up @@ -235,8 +236,9 @@ def manage_profile_stats(self, sort='time', limit=200, stripDirs=1, mode='stats'
from copy import copy; stats= copy(stats)
stats.strip_dirs()
stats.sort_stats(sort)
stats.stream = output = StringIO()
getattr(stats,'print_%s' % mode)(limit)
return stats.stream.getvalue()
return output.getvalue()

def manage_getSysPath(self):
return list(sys.path)
Expand Down
4 changes: 1 addition & 3 deletions src/ZPublisher/Publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ def publish_module_profiled(module_name, stdin=sys.stdin, stdout=sys.stdout,
result=sys._pr_
pobj.create_stats()
if _pstat is None:
from cStringIO import StringIO
stream = StringIO()
_pstat = sys._ps_ = pstats.Stats(pobj, stream=stream)
_pstat = sys._ps_ = pstats.Stats(pobj)
else: _pstat.add(pobj)
finally:
_plock.release()
Expand Down

0 comments on commit 5260f10

Please sign in to comment.