Commit 8588a7d6 authored by Stefan H. Holek's avatar Stefan H. Holek

Don't break if Python distros ship without profile support (Debian, Ubuntu).

parent d4c1ee91
Unreleased Unreleased
- Don't break if Python distros ship without profile support (Debian, Ubuntu).
- Functional.publish() would hang if it got a request_method argument other - Functional.publish() would hang if it got a request_method argument other
than GET or HEAD while omitting the stdin argument. than GET or HEAD while omitting the stdin argument.
- installProduct() now becomes a noop if ZopeTestCase did not apply its - installProduct() now becomes a noop if ZopeTestCase did not apply its
......
...@@ -12,14 +12,18 @@ ...@@ -12,14 +12,18 @@
############################################################################## ##############################################################################
"""Profiling support for ZTC """Profiling support for ZTC
$Id: profiler.py,v 1.3 2005/01/01 14:02:44 shh42 Exp $ $Id$
""" """
import os, sys import os, sys
import interfaces import interfaces
from profile import Profile # Some distros ship without profile
from pstats import Stats try:
from profile import Profile
from pstats import Stats
except ImportError:
def Profile(): pass
_profile = Profile() _profile = Profile()
_have_stats = 0 _have_stats = 0
...@@ -30,9 +34,12 @@ strip_dirs = 1 ...@@ -30,9 +34,12 @@ strip_dirs = 1
def runcall(*args, **kw): def runcall(*args, **kw):
global _have_stats if _profile is None:
_have_stats = 1 return apply(args[0], args[1:], kw)
return apply(_profile.runcall, args, kw) else:
global _have_stats
_have_stats = 1
return apply(_profile.runcall, args, kw)
def print_stats(limit=limit, sort=sort, strip_dirs=strip_dirs): def print_stats(limit=limit, sort=sort, strip_dirs=strip_dirs):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment