[Erp5-report] r33995 nicolas.dumazet - in /erp5/trunk/products/ERP5Type: ./ Constraint/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Mar 23 11:44:41 CET 2010


Author: nicolas.dumazet
Date: Tue Mar 23 11:44:39 2010
New Revision: 33995

URL: http://svn.erp5.org?rev=33995&view=rev
Log:
Postpone as much as possible import to prevent loops

This allows ActiveObject import in SQLCatalog, enabling again activate() on
SQL Catalog, and eventually fixing the current test failures (AttributeError:
SQLCatalog_catalogTransformation raised on portal/portal_catalog)

A proper, durable fix to the silent import failures in SQLCatalog is still
required.

Modified:
    erp5/trunk/products/ERP5Type/Constraint/AttributeUnicity.py
    erp5/trunk/products/ERP5Type/Utils.py

Modified: erp5/trunk/products/ERP5Type/Constraint/AttributeUnicity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Constraint/AttributeUnicity.py?rev=33995&r1=33994&r2=33995&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Constraint/AttributeUnicity.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Constraint/AttributeUnicity.py [utf8] Tue Mar 23 11:44:39 2010
@@ -32,7 +32,6 @@
 
 from PropertyExistence import PropertyExistence
 from Products.CMFCore.Expression import Expression
-from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
 
 class AttributeUnicity(PropertyExistence):
   """
@@ -69,6 +68,7 @@
       from Products.ERP5Type.Utils import createExpressionContext
       econtext = createExpressionContext(obj)
       criterion_dict = expression(econtext)
+      from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery
       # Add uid in criterion keys to avoid fetching current object.
       criterion_dict['query'] = NegatedQuery(Query(uid=obj.getUid()))
       portal = obj.portal_catalog.getPortalObject()

Modified: erp5/trunk/products/ERP5Type/Utils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Utils.py?rev=33995&r1=33994&r2=33995&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Utils.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Utils.py [utf8] Tue Mar 23 11:44:39 2010
@@ -64,7 +64,6 @@
 from Products.ZCatalog.Lazy import LazyMap
 
 from Products.ERP5Type import Permissions
-from Products.ERP5Type import Constraint
 
 from Products.ERP5Type.Accessor.Constant import PropertyGetter as \
     PropertyConstantGetter
@@ -1125,6 +1124,7 @@
 
     constraint_definition -- the constraint with all attributes
   """
+  from Products.ERP5Type import Constraint
   try:
     consistency_class = getattr(Constraint, constraint_definition['type'])
   except AttributeError:
@@ -1501,10 +1501,11 @@
         createRelatedValueAccessors(property_holder, cat, read_permission=read_permission)
       # Unnecessary to create these accessors more than once.
       base_category_dict.clear()
+    from Products.ERP5Type.Constraint import PropertyTypeValidity
     # Create the constraint method list - always check type
     property_holder.constraints = [
-                  Constraint.PropertyTypeValidity(id='type_check',
-                  description="Type Validity Check Error") ]
+                  PropertyTypeValidity(id='type_check',
+                    description="Type Validity Check Error") ]
 
     for const in constraint_list:
       createConstraintList(property_holder, constraint_definition=const)




More information about the Erp5-report mailing list