Commit 53ac23cc authored by Julien Muchembled's avatar Julien Muchembled

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
parent cc7b1372
......@@ -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()
......
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