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):
meta_type = 'ERP5 Accounting Transaction Balance Constraint'
portal_type = 'Accounting Transaction Balance Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.AccountingTransactionBalanceConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.AccountingTransactionBalanceConstraint,)
def _checkConsistency(self, obj, fixit=0):
"""
......
......@@ -43,10 +43,8 @@ class ResourceMeasuresConsistencyConstraint(ConstraintMixin):
meta_type = 'ERP5 Resource Measures Consistency Constraint'
portal_type = 'Resource Measures Consistency Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.ResourceMeasuresConsistencyConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.ResourceMeasuresConsistencyConstraint,)
def _checkConsistency(self, obj, fixit=0):
"""
......
......@@ -42,10 +42,8 @@ class TradeModelLineCellConsistencyConstraint(ConstraintMixin):
meta_type = 'ERP5 Trade Model Line Cell Consistency Constraint'
portal_type = 'Trade Model Line Cell Consistency Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.TradeModelLineCellConsistencyConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.TradeModelLineCellConsistencyConstraint,)
def _checkConsistency(self, document, fixit=0):
"""
......
......@@ -41,10 +41,6 @@ class TransactionQuantityValueFeasabilityConstraint(ConstraintMixin):
meta_type = 'ERP5 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):
"""
Check if the quantity of the transaction is possible
......
......@@ -38,10 +38,6 @@ class TransactionQuantityValueValidityConstraint(ConstraintMixin):
meta_type = 'ERP5 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):
"""
Check if the quantity of the transaction is greater than the
......
......@@ -59,10 +59,8 @@ class AttributeEqualityConstraint(ConstraintMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.AttributeEqualityConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.AttributeEqualityConstraint,)
security.declareProtected(Permissions.AccessContentsInformation,
'checkConsistency')
......
......@@ -48,10 +48,8 @@ class CategoryExistenceConstraint(ConstraintMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.CategoryExistenceConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.CategoryExistenceConstraint,)
def _calculateArity(self, obj, base_category, portal_type_list):
return len(obj.getCategoryMembershipList(base_category,
......
......@@ -56,10 +56,8 @@ class CategoryMembershipArityConstraint(ConstraintMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.CategoryMembershipArityConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.CategoryMembershipArityConstraint,)
def _calculateArity(self, obj, base_category_list, portal_type_list):
return len(obj.getCategoryMembershipList(base_category_list,
......
......@@ -57,10 +57,8 @@ class ContentExistenceConstraint(ConstraintMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.ContentExistenceConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.ContentExistenceConstraint,)
def _checkConsistency(self, obj, fixit=0):
"""
......
......@@ -54,10 +54,8 @@ class PropertyExistenceConstraint(ConstraintMixin):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.PropertyExistenceConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.PropertyExistenceConstraint,)
security.declareProtected(Permissions.AccessContentsInformation,
'checkConsistency')
......
......@@ -44,10 +44,8 @@ class PropertyTypeValidityConstraint(ConstraintMixin):
meta_type = 'ERP5 Property Type Validity Constraint'
portal_type = 'Property Type Validity Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.PropertyTypeValidityConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.PropertyTypeValidityConstraint,)
# Initialize type dict
_type_dict = {
......
......@@ -61,10 +61,8 @@ class TALESConstraint(ConstraintMixin):
meta_type = 'ERP5 TALES Constraint'
portal_type = 'TALES Constraint'
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference,
PropertySheet.TALESConstraint)
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.TALESConstraint,)
def _checkConsistency(self, obj, fixit=0):
"""
......
......@@ -55,6 +55,10 @@ class ConstraintMixin(Predicate):
__allow_access_to_unprotected_subobjects__ = 1
implements( IConstraint, )
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Predicate,
PropertySheet.Reference)
def _getMessage(self, 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