[Erp5-report] r43961 arnaud.fontaine - in /erp5/trunk/products: ERP5/Document/ ERP5Type/Cor...
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Mar 4 07:20:31 CET 2011
Author: arnaud.fontaine
Date: Fri Mar 4 07:20:31 2011
New Revision: 43961
URL: http://svn.erp5.org?rev=43961&view=rev
Log:
Remove exportToFilesystemDefinitionDict in property and constraint
documents used by ZODB Property Sheets as it was only meaningful when
using Utils accessors generation which required a filesystem
definition dict
Modified:
erp5/trunk/products/ERP5/Document/AccountingTransactionBalanceConstraint.py
erp5/trunk/products/ERP5/Document/ResourceMeasuresConsistencyConstraint.py
erp5/trunk/products/ERP5/Document/TradeModelLineCellConsistencyConstraint.py
erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py
erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py
erp5/trunk/products/ERP5Type/Core/AcquiredProperty.py
erp5/trunk/products/ERP5Type/Core/AttributeEqualityConstraint.py
erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py
erp5/trunk/products/ERP5Type/Core/CategoryMembershipArityConstraint.py
erp5/trunk/products/ERP5Type/Core/CategoryProperty.py
erp5/trunk/products/ERP5Type/Core/CategoryRelatedMembershipArityConstraint.py
erp5/trunk/products/ERP5Type/Core/ContentExistenceConstraint.py
erp5/trunk/products/ERP5Type/Core/DynamicCategoryProperty.py
erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py
erp5/trunk/products/ERP5Type/Core/PropertySheet.py
erp5/trunk/products/ERP5Type/Core/PropertyTypeValidityConstraint.py
erp5/trunk/products/ERP5Type/Core/StandardProperty.py
erp5/trunk/products/ERP5Type/Core/TALESConstraint.py
erp5/trunk/products/ERP5Type/mixin/constraint.py
erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py
Modified: erp5/trunk/products/ERP5/Document/AccountingTransactionBalanceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/AccountingTransactionBalanceConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/AccountingTransactionBalanceConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/AccountingTransactionBalanceConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -41,8 +41,6 @@ class AccountingTransactionBalanceConstr
meta_type = 'ERP5 Accounting Transaction Balance Constraint'
portal_type = 'Accounting Transaction Balance Constraint'
- __compatibility_class_name__ = 'AccountingTransactionBalance'
-
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.AccountingTransactionBalanceConstraint,)
Modified: erp5/trunk/products/ERP5/Document/ResourceMeasuresConsistencyConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/ResourceMeasuresConsistencyConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/ResourceMeasuresConsistencyConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/ResourceMeasuresConsistencyConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -43,8 +43,6 @@ class ResourceMeasuresConsistencyConstra
meta_type = 'ERP5 Resource Measures Consistency Constraint'
portal_type = 'Resource Measures Consistency Constraint'
- __compatibility_class_name__ = 'ResourceMeasuresConsistency'
-
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.ResourceMeasuresConsistencyConstraint,)
Modified: erp5/trunk/products/ERP5/Document/TradeModelLineCellConsistencyConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TradeModelLineCellConsistencyConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TradeModelLineCellConsistencyConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TradeModelLineCellConsistencyConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -42,8 +42,6 @@ class TradeModelLineCellConsistencyConst
meta_type = 'ERP5 Trade Model Line Cell Consistency Constraint'
portal_type = 'Trade Model Line Cell Consistency Constraint'
- __compatibility_class_name__ = 'TradeModelLineCellConsistency'
-
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.TradeModelLineCellConsistencyConstraint,)
@@ -68,11 +66,3 @@ class TradeModelLineCellConsistencyConst
@see ERP5Type.mixin.constraint.ConstraintMixin._convertFromFilesystemDefinition
"""
yield dict(base_id=base_id)
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(TradeModelLineCellConsistencyConstraint,
- self).exportToFilesystemDefinitionDict()
-
- filesystem_definition_dict['base_id'] = self.getBaseId()
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransactionQuantityValueFeasabilityConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -41,8 +41,6 @@ class TransactionQuantityValueFeasabilit
meta_type = 'ERP5 Transaction Quantity Value Feasability Constraint'
portal_type = 'Transaction Quantity Value Feasability Constraint'
- __compatibility_class_name__ = 'TransactionQuantityValueFeasability'
-
def _checkConsistency(self, object, fixit=0):
"""
Check if the quantity of the transaction is possible
Modified: erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Document/TransactionQuantityValueValidityConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -38,8 +38,6 @@ class TransactionQuantityValueValidityCo
meta_type = 'ERP5 Transaction Quantity Value Validity Constraint'
portal_type = 'Transaction Quantity Value Validity Constraint'
- __compatibility_class_name__ = 'TransactionQuantityValueValidity'
-
def _checkConsistency(self, object, fixit=0):
"""
Check if the quantity of the transaction is greater than the
Modified: erp5/trunk/products/ERP5Type/Core/AcquiredProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/AcquiredProperty.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/AcquiredProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/AcquiredProperty.py [utf8] Fri Mar 4 07:20:31 2011
@@ -140,42 +140,6 @@ class AcquiredProperty(StandardProperty)
'content_translation_acquired_property_id',
'lines')
- # TODO: remove
- security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinition')
- def exportToFilesystemDefinition(self):
- """
- Return the filesystem definition of this ZODB property
-
- NOTE: Only meaningful for testing export of filesystem Property
- Sheet to the ZODB
- """
- filesystem_property_dict = \
- StandardProperty.exportToFilesystemDefinition(self)
-
- if filesystem_property_dict is None:
- return None
-
- acquisition_portal_type_expression = self._getExpressionFromString(
- self.getAcquisitionPortalType())
-
- portal_type_expression = self._getExpressionFromString(
- self.getContentPortalType())
-
- filesystem_property_dict.update({
- 'acquisition_base_category': self.getAcquisitionBaseCategoryList(),
- 'acquisition_object_id': self.getAcquisitionObjectIdList(),
- 'acquisition_portal_type': acquisition_portal_type_expression,
- 'acquisition_accessor_id': self.getAcquisitionAccessorId(),
- 'alt_accessor_id': self.getAltAccessorIdList(),
- 'acquisition_copy_value': self.getAcquisitionCopyValue(),
- 'acquisition_mask_value': self.getAcquisitionMaskValue(),
- 'portal_type': portal_type_expression,
- 'acquired_property_id': self.getContentAcquiredPropertyIdList(),
- 'translation_acquired_property_id': self.getContentTranslationAcquiredPropertyIdList()})
-
- return filesystem_property_dict
-
@classmethod
def _asPropertyMap(cls, property_dict):
"""
Modified: erp5/trunk/products/ERP5Type/Core/AttributeEqualityConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/AttributeEqualityConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/AttributeEqualityConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/AttributeEqualityConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -59,8 +59,6 @@ class AttributeEqualityConstraint(Proper
meta_type = 'ERP5 Attribute Equality Constraint'
portal_type = 'Attribute Equality Constraint'
- __compatibility_class_name__ = 'AttributeEquality'
-
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
@@ -136,12 +134,3 @@ class AttributeEqualityConstraint(Proper
"""
for name, value in property_dict.iteritems():
yield dict(name=value)
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(AttributeEqualityConstraint,
- self).exportToFilesystemDefinitionDict()
-
- filesystem_definition_dict[self.getConstraintAttributeName()] = \
- Expression(self.getConstraintAttributeValue())
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/CategoryExistenceConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -46,8 +46,6 @@ class CategoryExistenceConstraint(Constr
meta_type = 'ERP5 Category Existence Constraint'
portal_type = 'Category Existence Constraint'
- __compatibility_class_name__ = 'CategoryExistence'
-
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
@@ -125,21 +123,3 @@ class CategoryExistenceConstraint(Constr
yield dict(constraint_base_category_list=base_category_dict.keys(),
constraint_portal_type=constraint_portal_type_str)
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(CategoryExistenceConstraint,
- self).exportToFilesystemDefinitionDict()
-
- # There is only one ZODB Constraint class for filesystem
- # Constraints CategoryExistence and CategoryAcquiredExistence
- # constraints
- if self.getUseAcquisition():
- filesystem_definition_dict['type'] = 'CategoryAcquiredExistence'
-
- filesystem_definition_dict['portal_type'] = \
- Expression(self.getConstraintPortalType())
-
- for category in self.getConstraintBaseCategoryList():
- filesystem_definition_dict[category] = 1
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5Type/Core/CategoryMembershipArityConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/CategoryMembershipArityConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/CategoryMembershipArityConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/CategoryMembershipArityConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -54,8 +54,6 @@ class CategoryMembershipArityConstraint(
meta_type = 'ERP5 Category Membership Arity Constraint'
portal_type = 'Category Membership Arity Constraint'
- __compatibility_class_name__ = 'CategoryMembershipArity'
-
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
@@ -160,25 +158,3 @@ class CategoryMembershipArityConstraint(
zodb_property_dict['max_arity'] = int(max_arity)
yield zodb_property_dict
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(CategoryMembershipArityConstraint,
- self).exportToFilesystemDefinitionDict()
-
- # There is only one ZODB Constraint class for filesystem
- # Constraints CategoryMembershipArity and
- # CategoryAcquiredMembershipArity constraints
- if self.getUseAcquisition():
- filesystem_definition_dict['type'] = 'CategoryAcquiredMembershipArity'
-
- filesystem_definition_dict['min_arity'] = str(self.getMinArity())
-
- if self.hasMaxArity():
- filesystem_definition_dict['max_arity'] = str(self.getMaxArity())
-
- filesystem_definition_dict['portal_type'] = \
- Expression(self.getConstraintPortalType())
-
- filesystem_definition_dict['base_category'] = self.getConstraintBaseCategoryList()
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5Type/Core/CategoryProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/CategoryProperty.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/CategoryProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/CategoryProperty.py [utf8] Fri Mar 4 07:20:31 2011
@@ -51,15 +51,6 @@ class CategoryProperty(IdAsReferenceMixi
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.Reference)
- # TODO: REMOVE
- security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinition')
- def exportToFilesystemDefinition(self):
- """
- Return the filesystem definition of the property
- """
- return self.getReference()
-
security.declareProtected(Permissions.AccessContentsInformation,
'importFromFilesystemDefinition')
@classmethod
Modified: erp5/trunk/products/ERP5Type/Core/CategoryRelatedMembershipArityConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/CategoryRelatedMembershipArityConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/CategoryRelatedMembershipArityConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/CategoryRelatedMembershipArityConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -58,8 +58,6 @@ class CategoryRelatedMembershipArityCons
meta_type = 'ERP5 Category Related Membership Arity Constraint'
portal_type = 'Category Related Membership Arity Constraint'
- __compatibility_class_name__ = 'CategoryRelatedMembershipArity'
-
property_sheets = CategoryMembershipArityConstraint.property_sheets + \
(PropertySheet.CategoryRelatedMembershipArityConstraint,)
Modified: erp5/trunk/products/ERP5Type/Core/ContentExistenceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/ContentExistenceConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/ContentExistenceConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/ContentExistenceConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -54,8 +54,6 @@ class ContentExistenceConstraint(Constra
meta_type = 'ERP5 Content Existence Constraint'
portal_type = 'Content Existence Constraint'
- __compatibility_class_name__ = 'ContentExistence'
-
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
@@ -110,12 +108,3 @@ class ContentExistenceConstraint(Constra
portal_type.text or 'python: ' + repr(portal_type)
yield dict(constraint_portal_type=constraint_portal_type_str)
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(ContentExistenceConstraint,
- self).exportToFilesystemDefinitionDict()
-
- filesystem_definition_dict['portal_type'] = \
- Expression(self.getConstraintPortalType())
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5Type/Core/DynamicCategoryProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/DynamicCategoryProperty.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/DynamicCategoryProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/DynamicCategoryProperty.py [utf8] Fri Mar 4 07:20:31 2011
@@ -50,19 +50,6 @@ class DynamicCategoryProperty(CategoryPr
property_sheets = (PropertySheet.SimpleItem,
PropertySheet.DynamicCategoryProperty)
- # TODO: REMOVE
- security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinition')
- def exportToFilesystemDefinition(self):
- """
- Return the filesystem definition of the property
- """
- expression_string = self.getCategoryExpression()
- if expression_string is None:
- return None
-
- return Expression(expression_string)
-
security.declareProtected(Permissions.AccessContentsInformation,
'importFromFilesystemDefinition')
@classmethod
Modified: erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/PropertyExistenceConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -50,8 +50,6 @@ class PropertyExistenceConstraint(Constr
meta_type = 'ERP5 Property Existence Constraint'
portal_type = 'Property Existence Constraint'
- __compatibility_class_name__ = 'PropertyExistence'
-
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
@@ -113,12 +111,3 @@ class PropertyExistenceConstraint(Constr
}
"""
yield dict(constraint_property_list=property_dict.keys())
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(PropertyExistenceConstraint,
- self).exportToFilesystemDefinitionDict()
-
- for constraint_property in self.getConstraintPropertyList():
- filesystem_definition_dict[constraint_property] = None
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5Type/Core/PropertySheet.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/PropertySheet.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/PropertySheet.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/PropertySheet.py [utf8] Fri Mar 4 07:20:31 2011
@@ -48,44 +48,6 @@ class PropertySheet(Folder):
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
- # TODO: REMOVE
- security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinition')
- def exportToFilesystemDefinition(self):
- """
- Export the ZODB Property Sheet to its filesystem definition as a
- tuple (properties, categories, constraints)
- """
- properties = []
- constraints = []
- categories = []
-
- for item in self.contentValues():
- definition = item.exportToFilesystemDefinition()
-
- # If a category doesn't have a name yet or the constraint class
- # returned is None, then just skip it
- if definition is None:
- LOG("ERP5Type.Core.PropertySheet", INFO,
- "Skipping property with ID '%s' in Property Sheet '%s'" % \
- (item.getId(), self.getId()))
-
- continue
-
- portal_type = item.getPortalType()
-
- if portal_type == "Category Property" or \
- portal_type == "Dynamic Category Property":
- categories.append(definition)
-
- elif portal_type.endswith('Constraint'):
- constraints.append(definition)
-
- else:
- properties.append(definition)
-
- return (properties, categories, constraints)
-
security.declarePrivate('createAccessorHolder')
def createAccessorHolder(self, expression_context, portal):
"""
Modified: erp5/trunk/products/ERP5Type/Core/PropertyTypeValidityConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/PropertyTypeValidityConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/PropertyTypeValidityConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/PropertyTypeValidityConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -44,8 +44,6 @@ class PropertyTypeValidityConstraint(Con
meta_type = 'ERP5 Property Type Validity Constraint'
portal_type = 'Property Type Validity Constraint'
- __compatibility_class_name__ = 'PropertyTypeValidity'
-
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.PropertyTypeValidityConstraint,)
Modified: erp5/trunk/products/ERP5Type/Core/StandardProperty.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/StandardProperty.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/StandardProperty.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/StandardProperty.py [utf8] Fri Mar 4 07:20:31 2011
@@ -131,44 +131,6 @@ class StandardProperty(IdAsReferenceMixi
'translation_domain',
'string')
- # TODO: REMOVE
- @staticmethod
- def _getExpressionFromString(expression_string):
- """
- Get a TALES Expression instance from a string value
- """
- if expression_string is None:
- return None
-
- return Expression(expression_string)
-
- # TODO: REMOVE
- security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinition')
- def exportToFilesystemDefinition(self):
- """
- Return the filesystem definition of this ZODB property
-
- NOTE: Only meaningful for testing export of filesystem Property
- Sheet to the ZODB
- """
- property_default_value = self._getExpressionFromString(self.getPropertyDefault())
-
- reference = self.getReference()
- if reference:
- return {'id': reference,
- 'description': self.getDescription(),
- 'type': self.getElementaryType(),
- 'storage_id': self.getStorageId(),
- 'multivalued': self.getMultivalued(),
- 'default': property_default_value,
- 'range': self.getRange(),
- 'preference': self.getPreference(),
- 'read_permission': self.getReadPermission(),
- 'write_permission': self.getWritePermission(),
- 'translatable': self.getTranslatable(),
- 'translation_domain': self.getTranslationDomain()}
-
@classmethod
def _asPropertyMap(cls, property_dict):
"""
Modified: erp5/trunk/products/ERP5Type/Core/TALESConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Core/TALESConstraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Core/TALESConstraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Core/TALESConstraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -61,8 +61,6 @@ class TALESConstraint(ConstraintMixin):
meta_type = 'ERP5 TALES Constraint'
portal_type = 'TALES Constraint'
- __compatibility_class_name__ = 'TALESConstraint'
-
property_sheets = ConstraintMixin.property_sheets + \
(PropertySheet.TALESConstraint,)
@@ -95,11 +93,3 @@ class TALESConstraint(ConstraintMixin):
@staticmethod
def _convertFromFilesystemDefinition(expression):
yield dict(expression=expression)
-
- def exportToFilesystemDefinitionDict(self):
- filesystem_definition_dict = super(TALESConstraint,
- self).exportToFilesystemDefinitionDict()
-
- filesystem_definition_dict['expression'] = self.getExpression()
-
- return filesystem_definition_dict
Modified: erp5/trunk/products/ERP5Type/mixin/constraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/mixin/constraint.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/mixin/constraint.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/mixin/constraint.py [utf8] Fri Mar 4 07:20:31 2011
@@ -57,11 +57,6 @@ class ConstraintMixin(IdAsReferenceMixin
# importing or exporting from/to filesystem Constraint
_message_id_tuple = ()
- # Store the filesystem name of the ZODB Constraint as there are
- # several different naming for filesystem constraints (*only* useful
- # for exportToFilesystemDefinitionDict)
- __compatibility_class_name__ = None
-
__allow_access_to_unprotected_subobjects__ = 1
implements( IConstraint, )
@@ -106,27 +101,6 @@ class ConstraintMixin(IdAsReferenceMixin
"""
return self.checkConsistency(obj, fixit=1, **kw)
- security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinition')
- def exportToFilesystemDefinition(self):
- """
- Return a temporary copy of the constraint object (with acquisition
- wrapping removed) in order to maintain compatibility and be able
- to use setDefaultProperties
-
- NOTE: A filesystem constraint is defined by a dict, then depending
- on the 'type' of the constraint, the appropriate class in
- ERP5Type.Constraint is instanciated with the dict. This is no
- longer needed for ZODB Constraints because they are already
- Documents.
-
- @see exportToFilesystemDefinitionDict() to export a ZODB
- Constraint as a dict.
-
- XXX: remove as soon as the code is stable
- """
- return self.asContext().aq_base
-
def _getExpressionValue(self, obj, expression_string):
"""
Get the Python value from an Expression string, but check before
@@ -220,29 +194,6 @@ class ConstraintMixin(IdAsReferenceMixin
context.newContent(**constraint_definition_dict)
security.declareProtected(Permissions.AccessContentsInformation,
- 'exportToFilesystemDefinitionDict')
- def exportToFilesystemDefinitionDict(self):
- """
- Export the ZODB Constraint as a filesystem definition dict,
- meaningful *only* for testing that a filesystem Constraint has
- been properly converted
-
- @see exportToFilesystemDefinition()
- """
- filesystem_definition_dict = dict(
- id=self.getReference(),
- description=self.getDescription(),
- type=self.__compatibility_class_name__)
-
- if self.hasTestTalesExpression():
- filesystem_definition_dict['condition'] = self.getTestTalesExpression()
-
- for message_id in self._message_id_tuple:
- filesystem_definition_dict[message_id] = self._getMessage(message_id)
-
- return filesystem_definition_dict
-
- security.declareProtected(Permissions.AccessContentsInformation,
'applyOnAccessorHolder')
def applyOnAccessorHolder(self, accessor_holder, expression_context, portal):
accessor_holder.constraints.append(self.asContext().aq_base)
Modified: erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py?rev=43961&r1=43960&r2=43961&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/tests/testDynamicClassGeneration.py [utf8] Fri Mar 4 07:20:31 2011
@@ -1107,228 +1107,6 @@ class TestZodbPropertySheet(ERP5TypeTest
self.fail("Creating a Category Expression with syntax error raises "\
"an error")
-from Products.CMFCore.Expression import Expression
-
-class TestZodbImportFilesystemPropertySheet(ERP5TypeTestCase):
- """
- Check that importing filesystem Property Sheets into ZODB the same
- properties and their values
- """
- # The following fields of properties are no longer defined in ZODB
- # Property Sheets because they have been deprecated
- deprecated_field_name_tuple = ('mode',
- 'select_variable',
- 'label',
- 'acquisition_depends',
- 'acquisition_sync_value')
-
- def afterSetUp(self):
- # Mapping between the field name of a property and the default
- # value as defined in StandardProperty and AcquiredProperty,
- # meaningful because exporting a property relies on accessor which
- # returns the default value if the field value is not set
- self.filesystem_field_default_value_dict = {}
-
- from Products.ERP5Type.PropertySheet import StandardProperty, AcquiredProperty
- for property_dict in StandardProperty._properties + AcquiredProperty._properties:
- try:
- self.filesystem_field_default_value_dict[property_dict['id']] = \
- property_dict['default']
- except KeyError:
- # Some fields may not defined a default value (such as 'id')
- continue
-
- def _checkPropertyOrConstraintField(self,
- property_sheet_name,
- field_name,
- filesystem_value,
- zodb_value):
- """
- Check whether the given filesystem property or constraint value
- and the given ZODB property value are equal
- """
- if isinstance(zodb_value, (list, tuple)) and \
- isinstance(filesystem_value, (list, tuple)):
- self.failIfDifferentSet(
- zodb_value, filesystem_value,
- msg="%s: %s: filesystem value: %s, ZODB value: %s" % \
- (property_sheet_name, field_name, filesystem_value, zodb_value))
-
- else:
- # In ZODB Property Sheets, we have to get the TALES Expression
- # as a string for properties, which used to be Expression in
- # filesystem Property Sheets or are now Expression (because they
- # used to be defined as Python types, such as tuple or int...)
- if isinstance(zodb_value, Expression):
- # In filesystem Property Sheets, acquisition_portal_type and
- # portal_type, might be instances of Expression
- if isinstance(filesystem_value, Expression):
- zodb_value = zodb_value.text
- filesystem_value = filesystem_value.text
- # Otherwise, just convert the filesystem value to a TALES
- # Expression string
- else:
- zodb_value = zodb_value.text
- filesystem_value = 'python: ' + repr(filesystem_value)
-
- self.failUnlessEqual(
- zodb_value, filesystem_value,
- msg="%s: %s: filesystem value: %s, ZODB value: %s" % \
- (property_sheet_name, field_name, filesystem_value,
- zodb_value))
-
- def _checkPropertyOrConstraintDefinitionTuple(self,
- property_sheet_name,
- filesystem_property_tuple,
- zodb_property_tuple):
- """
- Check whether all properties or constraints have been properly
- converted from the filesystem to the ZODB Property Sheet
- """
- # Check whether all the properties or constraints are present in
- # the given ZODB Property Sheet
- self.assertEqual(
- len(filesystem_property_tuple), len(zodb_property_tuple),
- msg="%s: too many properties: filesystem: %s, ZODB: %s" % \
- (property_sheet_name, filesystem_property_tuple, zodb_property_tuple))
-
- # Map filesystem property or constraint IDs to their definition
- filesystem_property_id_dict = {}
- for property_dict in filesystem_property_tuple:
- filesystem_property_id_dict[property_dict['id']] = property_dict
-
- # Check each property or constraint defined in ZODB against the
- # filesystem dict defined before
- for zodb_property_dict in zodb_property_tuple:
- # Meaningful to ensure that there is no missing field within a
- # property or constraint
- validated_field_counter = 0
-
- filesystem_property_dict = \
- filesystem_property_id_dict[zodb_property_dict['id']]
-
- # Check each property or constraint field
- for field_name, zodb_value in zodb_property_dict.iteritems():
- if field_name in filesystem_property_dict:
- self._checkPropertyOrConstraintField(
- property_sheet_name, field_name,
- filesystem_property_dict[field_name],
- zodb_value)
-
- # As we are using accessors when exporting the ZODB Property
- # Sheet to its filesystem definition, there may be additional
- # fields set to their default value
- elif field_name in self.filesystem_field_default_value_dict:
- self.assertEqual(
- self.filesystem_field_default_value_dict[field_name],
- zodb_value,
- msg="%s: Wrong default value %s for %s" % \
- (property_sheet_name, zodb_value, field_name))
-
- validated_field_counter += 1
-
- if len(filesystem_property_dict) != validated_field_counter:
- missing_field_name_list = [
- k for k in filesystem_property_dict \
- if k not in zodb_property_dict and \
- k not in self.deprecated_field_name_tuple ]
-
- self.assertTrue(
- len(missing_field_name_list) == 0,
- msg="%s: missing fields: %s: filesystem: %s, ZODB: %s" % \
- (property_sheet_name, missing_field_name_list,
- filesystem_property_dict, zodb_property_dict))
-
- def _checkCategoryTuple(self,
- property_sheet_name,
- filesystem_category_tuple,
- zodb_category_tuple):
- """
- Check whether all categories have been properly converted
- """
- # There should be the same number of categories
- self.assertEqual(
- len(filesystem_category_tuple), len(zodb_category_tuple),
- msg="%s: Missing/added categories: filesystem: %s, ZODB: %s" % \
- (property_sheet_name, filesystem_category_tuple, zodb_category_tuple))
-
- # Some Categories are instance of Expression, so compute a list of
- # categories as strings
- zodb_category_list = [
- isinstance(category, Expression) and category.text or category \
- for category in zodb_category_tuple ]
-
- # Now, compare filesystem categories with ZODB
- for category in filesystem_category_tuple:
- if isinstance(category, Expression):
- category = category.text
-
- self.assertTrue(
- category in zodb_category_list,
- msg="%s: Missing category %s: ZODB: %s" % \
- (property_sheet_name, category, zodb_category_list))
-
- def testZodbImportPropertySheet(self):
- """
- Create Property Sheets on portal_property_sheets from their
- definition on the filesystem and then test that they are
- equivalent
- """
- portal = self.getPortalObject().portal_property_sheets
-
- from Products.ERP5PropertySheetLegacy import PropertySheet
- import os
-
- property_sheets_tool = self.portal.portal_property_sheets
- property_sheet_legacy_class_dict = {}
- for module in os.listdir(os.path.dirname(PropertySheet.__file__)):
- if module == '__init__.py' or module[-3:] != '.py':
- continue
-
- filename = module[:-3]
-
- property_sheet_legacy_class_dict[filename] = \
- getattr(__import__(filename, locals(), globals()), filename)
-
- # Get all the property sheets defined on the filesystem
- for name, klass in property_sheet_legacy_class_dict.iteritems():
- filesystem_property_sheet = klass
- property_sheet_name = name
-
- # Rename the filesystem Property Sheet class to avoid clashing
- # with existing Property Sheets in portal_property_sheets
- filesystem_property_sheet.__name__ = "%s_%s" % \
- (self.__class__.__name__, property_sheet_name)
-
- zodb_property_sheet = PropertySheetDocument.importFromFilesystemDefinition(
- property_sheets_tool, filesystem_property_sheet)
-
- self.assertTrue(filesystem_property_sheet.__name__ in \
- property_sheets_tool.objectIds())
-
- zodb_property_tuple, zodb_category_tuple, zodb_constraint_class_tuple = \
- zodb_property_sheet.exportToFilesystemDefinition()
-
- self._checkPropertyOrConstraintDefinitionTuple(
- property_sheet_name,
- getattr(filesystem_property_sheet, '_properties', []),
- zodb_property_tuple)
-
- self._checkCategoryTuple(property_sheet_name,
- getattr(filesystem_property_sheet,
- '_categories', []),
- zodb_category_tuple)
-
- self._checkPropertyOrConstraintDefinitionTuple(
- property_sheet_name, getattr(filesystem_property_sheet,
- '_constraints', []),
- [ zodb_constraint_class.exportToFilesystemDefinitionDict() \
- for zodb_constraint_class in zodb_constraint_class_tuple ])
-
-TestZodbImportFilesystemPropertySheet = skip(
- "ERP5PropertySheetLegacy is now obsolete")(
- TestZodbImportFilesystemPropertySheet)
-
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPortalTypeClass))
More information about the Erp5-report
mailing list