[Erp5-report] r42906 jm - /erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Feb 1 20:05:39 CET 2011


Author: jm
Date: Tue Feb  1 20:05:39 2011
New Revision: 42906

URL: http://svn.erp5.org?rev=42906&view=rev
Log:
Fix try...finally construct for Python < 2.5

Modified:
    erp5/trunk/products/ERP5Type/dynamic/lazy_class.py

Modified: erp5/trunk/products/ERP5Type/dynamic/lazy_class.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/dynamic/lazy_class.py?rev=42906&r1=42905&r2=42906&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/dynamic/lazy_class.py [utf8] Tue Feb  1 20:05:39 2011
@@ -286,41 +286,41 @@ class PortalTypeMetaClass(GhostBaseMetaC
       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()
 



More information about the Erp5-report mailing list