[Zope-Checkins] SVN: Zope/branches/2.12/ Use cProfile where possible for the

Ross Patterson me at rpatterson.net
Thu Nov 18 17:09:03 EST 2010


Log message for revision 118469:
  Use cProfile where possible for the
  Control_Panel/DebugInfo/manage_profile ZMI view.  This has been
  available since Python 2.5 and we no longer support Python 2.4 so
  there's little reason not to use the faster profiler.
  

Changed:
  U   Zope/branches/2.12/doc/CHANGES.rst
  U   Zope/branches/2.12/src/ZPublisher/Publish.py

-=-
Modified: Zope/branches/2.12/doc/CHANGES.rst
===================================================================
--- Zope/branches/2.12/doc/CHANGES.rst	2010-11-18 22:03:10 UTC (rev 118468)
+++ Zope/branches/2.12/doc/CHANGES.rst	2010-11-18 22:09:03 UTC (rev 118469)
@@ -16,7 +16,10 @@
   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.
 
+
 2.12.13 (2010-11-06)
 --------------------
 

Modified: Zope/branches/2.12/src/ZPublisher/Publish.py
===================================================================
--- Zope/branches/2.12/src/ZPublisher/Publish.py	2010-11-18 22:03:10 UTC (rev 118468)
+++ Zope/branches/2.12/src/ZPublisher/Publish.py	2010-11-18 22:09:03 UTC (rev 118469)
@@ -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:



More information about the Zope-Checkins mailing list