diff --git a/product/ERP5Type/Constraint/AttributeUnicity.py b/product/ERP5Type/Constraint/AttributeUnicity.py index d73398cc8dad4536b3a0c52bbb4277721e3d5771..0152a326af957f213f5150bb3eefc41adce1bbe9 100644 --- a/product/ERP5Type/Constraint/AttributeUnicity.py +++ b/product/ERP5Type/Constraint/AttributeUnicity.py @@ -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 @@ class AttributeUnicity(PropertyExistence): 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() diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py index 7b8fa96d8a9ca9b697253848b0bcc9b2c122b7d3..96d73baa81acfded0394c9ad739ed7e06dddf33b 100644 --- a/product/ERP5Type/Utils.py +++ b/product/ERP5Type/Utils.py @@ -64,7 +64,6 @@ from Products.PageTemplates.Expressions import SecureModuleImporter 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 @@ def createConstraintList(property_holder, constraint_definition): 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 @@ def setDefaultProperties(property_holder, object=None, portal=None): 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)