[Erp5-report] r22041 - /erp5/trunk/products/ERP5/PropertySheet/
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Jun 27 16:38:35 CEST 2008
Author: rafael
Date: Fri Jun 27 16:38:30 2008
New Revision: 22041
URL: http://svn.erp5.org?rev=22041&view=rev
Log:
Constraints was improved. Added nice messages, improved identation and added date_coerency constraint.
Modified:
erp5/trunk/products/ERP5/PropertySheet/TaskConstraint.py
erp5/trunk/products/ERP5/PropertySheet/TaskLineConstraint.py
Modified: erp5/trunk/products/ERP5/PropertySheet/TaskConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/TaskConstraint.py?rev=22041&r1=22040&r2=22041&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/TaskConstraint.py (original)
+++ erp5/trunk/products/ERP5/PropertySheet/TaskConstraint.py Fri Jun 27 16:38:30 2008
@@ -28,47 +28,61 @@
##############################################################################
class TaskConstraint:
- """
- Constraintsts For Task
- """
-
- _constraints = (
- { 'id' : 'title_existence',
- 'description' : 'Title must be defined',
- 'type' : 'StringAttributeMatch',
- 'title' : '^[^ ]',
- },
- { 'id' : 'source',
- 'description' : 'Source must be defined',
- 'type' : 'CategoryMembershipArity',
- 'min_arity' : '1',
- 'max_arity' : '1',
- 'portal_type' : ('Person', 'Organisation', 'Category'),
- 'base_category' : ('source',)
- },
- { 'id' : 'destination',
- 'description' : 'Destination must be defined',
- 'type' : 'CategoryMembershipArity',
- 'min_arity' : '1',
- 'max_arity' : '1',
- 'portal_type' : ('Person', 'Organisation', 'Category'),
- 'base_category' : ('destination',)
- },
- { 'id' : 'start_date_existence',
- 'description' : 'Property start_date must be defined',
- 'type' : 'PropertyExistence',
- 'start_date' : None,
- },
- { 'id' : 'stop_date_existence',
- 'description' : 'Property stop date must be defined',
- 'type' : 'PropertyExistence',
- 'stop_date' : None,
- },
-
- { 'id' : 'lines',
- 'description' : 'Lines must be defined',
- 'type' : 'ContentExistence',
- 'portal_type' : ('Task Line', 'Task Report Line' ),
- },
- )
-
+ """
+ Constraintsts For Task
+ """
+
+ _constraints = (
+ { 'id' : 'title_existence',
+ 'description' : 'Title must be defined',
+ 'type' : 'PropertyExistence',
+ 'title' : None,
+ 'message_property_not_set': 'Title must be defined',
+ 'message_no_such_property' : 'Title must be defined',
+ },
+ { 'id' : 'source_category_membership_arity',
+ 'description' : 'Source must be defined',
+ 'type' : 'CategoryMembershipArity',
+ 'min_arity' : '1',
+ 'max_arity' : '1',
+ 'portal_type' : ('Person', 'Organisation', 'Category'),
+ 'base_category' : ('source',),
+ 'message_arity_with_portal_type_not_in_range': 'Assignee must be defined',
+ },
+ { 'id' : 'destination_category_membership_arity',
+ 'description' : 'Destination must be defined',
+ 'type' : 'CategoryMembershipArity',
+ 'min_arity' : '1',
+ 'max_arity' : '1',
+ 'portal_type' : ('Person', 'Organisation', 'Category'),
+ 'base_category' : ('destination',),
+ 'message_arity_with_portal_type_not_in_range': 'Location must be defined',
+ },
+ { 'id' : 'start_date_existence',
+ 'description' : 'Property start_date must be defined',
+ 'type' : 'PropertyExistence',
+ 'start_date' : None,
+ 'message_property_not_set': 'Begin Date must be defined',
+ 'message_no_such_property' : 'Begin Date must be defined'
+ },
+ { 'id' : 'stop_date_existence',
+ 'description' : 'Property stop date must be defined',
+ 'type' : 'PropertyExistence',
+ 'stop_date' : None,
+ 'message_property_not_set': 'End Date must be defined',
+ 'message_no_such_property' : 'End Date must be defined'
+ },
+ { 'id' : 'date_coherency',
+ 'description' : 'Stop Date must be after Start Date',
+ 'type' : 'TALESConstraint',
+ 'expression' : 'python: object.getStopDate() >= object.getStartDate()',
+ 'message_expression_false': 'End Date must be after Begin Date',
+ },
+ { 'id' : 'lines',
+ 'description' : 'Lines must be defined',
+ 'type' : 'ContentExistence',
+ 'portal_type' : ('Task Line', 'Task Report Line' ),
+ 'message_no_subobject_portal_type' : \
+ 'It is required create at least one Line.',
+ },
+ )
Modified: erp5/trunk/products/ERP5/PropertySheet/TaskLineConstraint.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/PropertySheet/TaskLineConstraint.py?rev=22041&r1=22040&r2=22041&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/PropertySheet/TaskLineConstraint.py (original)
+++ erp5/trunk/products/ERP5/PropertySheet/TaskLineConstraint.py Fri Jun 27 16:38:30 2008
@@ -27,21 +27,24 @@
##############################################################################
class TaskLineConstraint:
- """
- Task Line Constraints
- """
- _constraints = (
- { 'id' : 'quantity_existence',
- 'description' : 'Property quantity must be defined',
- 'type' : 'PropertyExistence',
- 'quantity' : None,
- },
- { 'id' : 'resource',
- 'description' : 'Resource must be defined',
- 'type' : 'CategoryMembershipArity',
- 'min_arity' : '1',
- 'max_arity' : '1',
- 'portal_type' : ( ),
- 'base_category' : ('resource',)
- },
- )
+ """
+ Task Line Constraints
+ """
+ _constraints = (
+ { 'id' : 'quantity_existence',
+ 'description' : 'Property quantity must be defined',
+ 'type' : 'PropertyExistence',
+ 'quantity' : None,
+ "message_property_not_set" : 'Quantity must be defined at Lines',
+ "message_no_such_property" : 'Quantity must be defined at Lines'
+ },
+ { 'id' : 'resource',
+ 'description' : 'Resource must be defined',
+ 'type' : 'CategoryMembershipArity',
+ 'min_arity' : '1',
+ 'max_arity' : '1',
+ 'portal_type' : ( ),
+ 'base_category' : ('resource',),
+ 'message_arity_not_in_range' : 'Resource must be defined at Lines.' ,
+ },
+ )
More information about the Erp5-report
mailing list