Commit 68f70575 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Define common Property Sheets within the Constraint mixin rather than

defining them in each Constraint



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41007 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 81f1e148
...@@ -41,10 +41,8 @@ class AccountingTransactionBalanceConstraint(ConstraintMixin): ...@@ -41,10 +41,8 @@ class AccountingTransactionBalanceConstraint(ConstraintMixin):
meta_type = 'ERP5 Accounting Transaction Balance Constraint' meta_type = 'ERP5 Accounting Transaction Balance Constraint'
portal_type = 'Accounting Transaction Balance Constraint' portal_type = 'Accounting Transaction Balance Constraint'
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.AccountingTransactionBalanceConstraint,)
PropertySheet.Reference,
PropertySheet.AccountingTransactionBalanceConstraint)
def _checkConsistency(self, obj, fixit=0): def _checkConsistency(self, obj, fixit=0):
""" """
......
...@@ -43,10 +43,8 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin): ...@@ -43,10 +43,8 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin):
meta_type = 'ERP5 Resource Measures Consistency Constraint' meta_type = 'ERP5 Resource Measures Consistency Constraint'
portal_type = 'Resource Measures Consistency Constraint' portal_type = 'Resource Measures Consistency Constraint'
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.ResourceMeasuresConsistencyConstraint,)
PropertySheet.Reference,
PropertySheet.ResourceMeasuresConsistencyConstraint)
def _checkConsistency(self, obj, fixit=0): def _checkConsistency(self, obj, fixit=0):
""" """
......
...@@ -42,10 +42,8 @@ class TradeModelLineCellConsistencyConstraint(ConstraintMixin): ...@@ -42,10 +42,8 @@ class TradeModelLineCellConsistencyConstraint(ConstraintMixin):
meta_type = 'ERP5 Trade Model Line Cell Consistency Constraint' meta_type = 'ERP5 Trade Model Line Cell Consistency Constraint'
portal_type = 'Trade Model Line Cell Consistency Constraint' portal_type = 'Trade Model Line Cell Consistency Constraint'
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.TradeModelLineCellConsistencyConstraint,)
PropertySheet.Reference,
PropertySheet.TradeModelLineCellConsistencyConstraint)
def _checkConsistency(self, document, fixit=0): def _checkConsistency(self, document, fixit=0):
""" """
......
...@@ -41,10 +41,6 @@ class TransactionQuantityValueFeasabilityConstraint(ConstraintMixin): ...@@ -41,10 +41,6 @@ class TransactionQuantityValueFeasabilityConstraint(ConstraintMixin):
meta_type = 'ERP5 Transaction Quantity Value Feasability Constraint' meta_type = 'ERP5 Transaction Quantity Value Feasability Constraint'
portal_type = 'Transaction Quantity Value Feasability Constraint' portal_type = 'Transaction Quantity Value Feasability Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference)
def _checkConsistency(self, object, fixit=0): def _checkConsistency(self, object, fixit=0):
""" """
Check if the quantity of the transaction is possible Check if the quantity of the transaction is possible
......
...@@ -38,10 +38,6 @@ class TransactionQuantityValueValidityConstraint(ConstraintMixin): ...@@ -38,10 +38,6 @@ class TransactionQuantityValueValidityConstraint(ConstraintMixin):
meta_type = 'ERP5 Transaction Quantity Value Validity Constraint' meta_type = 'ERP5 Transaction Quantity Value Validity Constraint'
portal_type = 'Transaction Quantity Value Validity Constraint' portal_type = 'Transaction Quantity Value Validity Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference)
def _checkConsistency(self, object, fixit=0): def _checkConsistency(self, object, fixit=0):
""" """
Check if the quantity of the transaction is greater than the Check if the quantity of the transaction is greater than the
......
...@@ -59,10 +59,8 @@ class AttributeEqualityConstraint(ConstraintMixin): ...@@ -59,10 +59,8 @@ class AttributeEqualityConstraint(ConstraintMixin):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.AttributeEqualityConstraint,)
PropertySheet.Reference,
PropertySheet.AttributeEqualityConstraint)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'checkConsistency') 'checkConsistency')
......
...@@ -48,10 +48,8 @@ class CategoryExistenceConstraint(ConstraintMixin): ...@@ -48,10 +48,8 @@ class CategoryExistenceConstraint(ConstraintMixin):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.CategoryExistenceConstraint,)
PropertySheet.Reference,
PropertySheet.CategoryExistenceConstraint)
def _calculateArity(self, obj, base_category, portal_type_list): def _calculateArity(self, obj, base_category, portal_type_list):
return len(obj.getCategoryMembershipList(base_category, return len(obj.getCategoryMembershipList(base_category,
......
...@@ -56,10 +56,8 @@ class CategoryMembershipArityConstraint(ConstraintMixin): ...@@ -56,10 +56,8 @@ class CategoryMembershipArityConstraint(ConstraintMixin):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.CategoryMembershipArityConstraint,)
PropertySheet.Reference,
PropertySheet.CategoryMembershipArityConstraint)
def _calculateArity(self, obj, base_category_list, portal_type_list): def _calculateArity(self, obj, base_category_list, portal_type_list):
return len(obj.getCategoryMembershipList(base_category_list, return len(obj.getCategoryMembershipList(base_category_list,
......
...@@ -57,10 +57,8 @@ class ContentExistenceConstraint(ConstraintMixin): ...@@ -57,10 +57,8 @@ class ContentExistenceConstraint(ConstraintMixin):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.ContentExistenceConstraint,)
PropertySheet.Reference,
PropertySheet.ContentExistenceConstraint)
def _checkConsistency(self, obj, fixit=0): def _checkConsistency(self, obj, fixit=0):
""" """
......
...@@ -54,10 +54,8 @@ class PropertyExistenceConstraint(ConstraintMixin): ...@@ -54,10 +54,8 @@ class PropertyExistenceConstraint(ConstraintMixin):
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.PropertyExistenceConstraint,)
PropertySheet.Reference,
PropertySheet.PropertyExistenceConstraint)
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'checkConsistency') 'checkConsistency')
......
...@@ -44,10 +44,8 @@ class PropertyTypeValidityConstraint(ConstraintMixin): ...@@ -44,10 +44,8 @@ class PropertyTypeValidityConstraint(ConstraintMixin):
meta_type = 'ERP5 Property Type Validity Constraint' meta_type = 'ERP5 Property Type Validity Constraint'
portal_type = 'Property Type Validity Constraint' portal_type = 'Property Type Validity Constraint'
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.PropertyTypeValidityConstraint,)
PropertySheet.Reference,
PropertySheet.PropertyTypeValidityConstraint)
# Initialize type dict # Initialize type dict
_type_dict = { _type_dict = {
......
...@@ -61,10 +61,8 @@ class TALESConstraint(ConstraintMixin): ...@@ -61,10 +61,8 @@ class TALESConstraint(ConstraintMixin):
meta_type = 'ERP5 TALES Constraint' meta_type = 'ERP5 TALES Constraint'
portal_type = 'TALES Constraint' portal_type = 'TALES Constraint'
property_sheets = (PropertySheet.SimpleItem, property_sheets = ConstraintMixin.property_sheets + \
PropertySheet.Predicate, (PropertySheet.TALESConstraint,)
PropertySheet.Reference,
PropertySheet.TALESConstraint)
def _checkConsistency(self, obj, fixit=0): def _checkConsistency(self, obj, fixit=0):
""" """
......
...@@ -55,6 +55,10 @@ class ConstraintMixin(Predicate): ...@@ -55,6 +55,10 @@ class ConstraintMixin(Predicate):
__allow_access_to_unprotected_subobjects__ = 1 __allow_access_to_unprotected_subobjects__ = 1
implements( IConstraint, ) implements( IConstraint, )
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference)
def _getMessage(self, message_id): def _getMessage(self, message_id):
""" """
Get the message corresponding to this message_id. Get the message corresponding to this message_id.
......
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