From 53ac23cc169aea6276244ce64620cb10d789b798 Mon Sep 17 00:00:00 2001 From: Julien Muchembled <jm@nexedi.com> Date: Tue, 1 Feb 2011 19:05:39 +0000 Subject: [PATCH] Fix try...finally construct for Python < 2.5 git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42906 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/dynamic/lazy_class.py | 60 +++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/product/ERP5Type/dynamic/lazy_class.py b/product/ERP5Type/dynamic/lazy_class.py index e80dd93b39..58127ed2fa 100644 --- a/product/ERP5Type/dynamic/lazy_class.py +++ b/product/ERP5Type/dynamic/lazy_class.py @@ -286,41 +286,41 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): raise AttributeError("Could not find a portal type class in" " class hierarchy") - ERP5Base.aq_method_lock.acquire() portal_type = klass.__name__ from Products.ERP5.ERP5Site import getSite site = getSite() + ERP5Base.aq_method_lock.acquire() try: try: - - class_definition = generatePortalTypeClass(site, portal_type) - except AttributeError: - LOG("ERP5Type.Dynamic", WARNING, - "Could not access Portal Type Object for type %r" - % portal_type, error=sys.exc_info()) - base_tuple = (ERP5BaseBroken, ) - attribute_dict = {} - interface_list = [] - base_category_list = [] - else: - base_tuple, interface_list, base_category_list, attribute_dict = class_definition - - klass.__isghost__ = False - klass.__bases__ = base_tuple - - klass.resetAcquisitionAndSecurity() - - for key, value in attribute_dict.iteritems(): - setattr(klass, key, value) - - klass._categories = base_category_list - - for interface in interface_list: - classImplements(klass, interface) - - klass.generatePortalTypeAccessors(site) - except: - import traceback; traceback.print_exc() + try: + class_definition = generatePortalTypeClass(site, portal_type) + except AttributeError: + LOG("ERP5Type.Dynamic", WARNING, + "Could not access Portal Type Object for type %r" + % portal_type, error=sys.exc_info()) + base_tuple = (ERP5BaseBroken, ) + attribute_dict = {} + interface_list = [] + base_category_list = [] + else: + base_tuple, interface_list, base_category_list, attribute_dict = class_definition + + klass.__isghost__ = False + klass.__bases__ = base_tuple + + klass.resetAcquisitionAndSecurity() + + for key, value in attribute_dict.iteritems(): + setattr(klass, key, value) + + klass._categories = base_category_list + + for interface in interface_list: + classImplements(klass, interface) + + klass.generatePortalTypeAccessors(site) + except Exception: + import traceback; traceback.print_exc() finally: ERP5Base.aq_method_lock.release() -- 2.30.9