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): ...@@ -286,41 +286,41 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
raise AttributeError("Could not find a portal type class in" raise AttributeError("Could not find a portal type class in"
" class hierarchy") " class hierarchy")
ERP5Base.aq_method_lock.acquire()
portal_type = klass.__name__ portal_type = klass.__name__
from Products.ERP5.ERP5Site import getSite from Products.ERP5.ERP5Site import getSite
site = getSite() site = getSite()
ERP5Base.aq_method_lock.acquire()
try: try:
try: try:
try:
class_definition = generatePortalTypeClass(site, portal_type) class_definition = generatePortalTypeClass(site, portal_type)
except AttributeError: except AttributeError:
LOG("ERP5Type.Dynamic", WARNING, LOG("ERP5Type.Dynamic", WARNING,
"Could not access Portal Type Object for type %r" "Could not access Portal Type Object for type %r"
% portal_type, error=sys.exc_info()) % portal_type, error=sys.exc_info())
base_tuple = (ERP5BaseBroken, ) base_tuple = (ERP5BaseBroken, )
attribute_dict = {} attribute_dict = {}
interface_list = [] interface_list = []
base_category_list = [] base_category_list = []
else: else:
base_tuple, interface_list, base_category_list, attribute_dict = class_definition base_tuple, interface_list, base_category_list, attribute_dict = class_definition
klass.__isghost__ = False klass.__isghost__ = False
klass.__bases__ = base_tuple klass.__bases__ = base_tuple
klass.resetAcquisitionAndSecurity() klass.resetAcquisitionAndSecurity()
for key, value in attribute_dict.iteritems(): for key, value in attribute_dict.iteritems():
setattr(klass, key, value) setattr(klass, key, value)
klass._categories = base_category_list klass._categories = base_category_list
for interface in interface_list: for interface in interface_list:
classImplements(klass, interface) classImplements(klass, interface)
klass.generatePortalTypeAccessors(site) klass.generatePortalTypeAccessors(site)
except: except Exception:
import traceback; traceback.print_exc() import traceback; traceback.print_exc()
finally: finally:
ERP5Base.aq_method_lock.release() 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