moksha/middleware/connector.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
New commits:
commit 641958b7a8aa713ef96ea5027ed759b8f443af05
Author: John (J5) Palmieri <johnp(a)redhat.com>
Date: Wed Aug 3 16:42:43 2011 -0400
if cProfile doesn't exist use profile instead
* RHEL 5 ships with python 2.4, cProfile was introduced in python 2.5
diff --git a/moksha/middleware/connector.py b/moksha/middleware/connector.py
index dfc126d..d2c3445 100644
--- a/moksha/middleware/connector.py
+++ b/moksha/middleware/connector.py
@@ -169,8 +169,10 @@ class MokshaConnectorMiddleware(object):
r = None
if asbool(config.get('profile.connectors')):
- import cProfile
-
+ try:
+ import cProfile as profile
+ except ImportError:
+ import profile
directory = config.get('profile.dir', '')
# Make sure the id is unique for each thread
@@ -200,7 +202,7 @@ class MokshaConnectorMiddleware(object):
# profile call
file_name = os.path.join(directory, prof_file_name)
- cProfile.runctx("result['r'] = conn_obj._dispatch(op, path,
remote_params, **dispatch_params)",
+ profile.runctx("result['r'] = conn_obj._dispatch(op, path,
remote_params, **dispatch_params)",
None,
{'conn_obj': conn_obj,
'op': op,
Show replies by date