summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNarayan Desai <desai@mcs.anl.gov>2009-05-14 15:24:13 +0000
committerNarayan Desai <desai@mcs.anl.gov>2009-05-14 15:24:13 +0000
commitc38f064095db05c2a9ca72e197a21098dccbd079 (patch)
treeb02e78aa2e47d7624860972276ba4e5d0017849c /src
parent32252e0dff7825e581c888ffb68fb954fcacc68a (diff)
downloadbcfg2-c38f064095db05c2a9ca72e197a21098dccbd079.tar.gz
bcfg2-c38f064095db05c2a9ca72e197a21098dccbd079.tar.bz2
bcfg2-c38f064095db05c2a9ca72e197a21098dccbd079.zip
Fix py2.4 portability (try/except/finally is 2.5+) (Reported by Lisa Giacchetti)
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5229 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src')
-rw-r--r--src/lib/Component.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/Component.py b/src/lib/Component.py
index 0a16c523f..0d556b059 100644
--- a/src/lib/Component.py
+++ b/src/lib/Component.py
@@ -204,18 +204,19 @@ class Component (object):
lock_done = time.time()
try:
method_start = time.time()
- result = method_func(*args)
- method_done = time.time()
+ try:
+ result = method_func(*args)
+ finally:
+ method_done = time.time()
+ if need_to_lock:
+ self.lock.release()
+ self.instance_statistics.add_value('component_lock',
+ lock_done - lock_start)
+ self.instance_statistics.add_value(method, method_done - method_start)
except Exception, e:
if getattr(e, "log", True):
self.logger.error(e, exc_info=True)
raise xmlrpclib.Fault(getattr(e, "fault_code", 1), str(e))
- finally:
- if need_to_lock:
- self.lock.release()
- self.instance_statistics.add_value('component_lock',
- lock_done - lock_start)
- self.instance_statistics.add_value(method, method_done - method_start)
return result
@exposed