Log message for revision 118471: Merge Control_Panel/DebugInfo/manage_profile ZMI view fixes from svn+ssh://svn.zope.org/repos/main/Zope/branches/2.12 r118262:118470
Changed: U Zope/branches/2.13/doc/CHANGES.rst U Zope/branches/2.13/src/App/ApplicationManager.py U Zope/branches/2.13/src/ZPublisher/Publish.py -=- Modified: Zope/branches/2.13/doc/CHANGES.rst =================================================================== --- Zope/branches/2.13/doc/CHANGES.rst 2010-11-18 22:29:15 UTC (rev 118470) +++ Zope/branches/2.13/doc/CHANGES.rst 2010-11-19 01:00:39 UTC (rev 118471) @@ -11,7 +11,14 @@ Bugs Fixed ++++++++++ +- Fixed the usage of pstats.Stats() output stream. The + Control_Panel/DebugInfo/manage_profile ZMI view has been broken + since Python 2.5. This breaks Python 2.4 compatibility when the + publisher-profile-file configuration option is set. +- Use cProfile where possible for the + Control_Panel/DebugInfo/manage_profile ZMI view. + Features Added ++++++++++++++ Modified: Zope/branches/2.13/src/App/ApplicationManager.py =================================================================== --- Zope/branches/2.13/src/App/ApplicationManager.py 2010-11-18 22:29:15 UTC (rev 118470) +++ Zope/branches/2.13/src/App/ApplicationManager.py 2010-11-19 01:00:39 UTC (rev 118471) @@ -232,17 +232,13 @@ stats = getattr(sys, '_ps_', None) if stats is None: return None - output = StringIO() - stdout = sys.stdout if stripDirs: from copy import copy stats = copy(stats) stats.strip_dirs() stats.sort_stats(sort) - sys.stdout = output - getattr(stats,'print_%s' % mode)(limit) - sys.stdout.flush() - sys.stdout = stdout + stats.stream = output = StringIO() + getattr(stats, 'print_%s' % mode)(limit) return output.getvalue() def manage_profile_reset(self): Modified: Zope/branches/2.13/src/ZPublisher/Publish.py =================================================================== --- Zope/branches/2.13/src/ZPublisher/Publish.py 2010-11-18 22:29:15 UTC (rev 118470) +++ Zope/branches/2.13/src/ZPublisher/Publish.py 2010-11-19 01:00:39 UTC (rev 118471) @@ -386,7 +386,12 @@ def publish_module_profiled(module_name, stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stderr, environ=os.environ, debug=0, request=None, response=None): - import profile, pstats + try: + import cProfile as profile + profile # pyflakes + except ImportError: + import profile + import pstats global _pstat _plock.acquire() try: @@ -403,7 +408,7 @@ result=sys._pr_ pobj.create_stats() if _pstat is None: - _pstat=sys._ps_=pstats.Stats(pobj) + _pstat = sys._ps_ = pstats.Stats(pobj) else: _pstat.add(pobj) finally: _plock.release() _______________________________________________ Zope-Checkins maillist - Zope-Checkins@zope.org https://mail.zope.org/mailman/listinfo/zope-checkins