[Erp5-report] r10162 - /erp5/trunk/products/ERP5Type/Constraint/PropertyTypeValidity.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Sep 19 14:41:11 CEST 2006
Author: jerome
Date: Tue Sep 19 14:41:08 2006
New Revision: 10162
URL: http://svn.erp5.org?rev=10162&view=rev
Log:
handle boolean type if supported by python
Modified:
erp5/trunk/products/ERP5Type/Constraint/PropertyTypeValidity.py
Modified: erp5/trunk/products/ERP5Type/Constraint/PropertyTypeValidity.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Constraint/PropertyTypeValidity.py?rev=10162&r1=10161&r2=10162&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Constraint/PropertyTypeValidity.py (original)
+++ erp5/trunk/products/ERP5Type/Constraint/PropertyTypeValidity.py Tue Sep 19 14:41:08 2006
@@ -31,6 +31,11 @@
from Constraint import Constraint
from DateTime import DateTime
+try:
+ boolean_types = (type(1), type(True))
+except NameError:
+ boolean_types = (type(1), )
+
class PropertyTypeValidity(Constraint):
"""
This constraint class allows to check / fix type of each
@@ -43,7 +48,7 @@
'string': (type('a'), ),
'text': (type('a'), ),
'int': (type(1), ),
- 'boolean': (type(1), ),
+ 'boolean': boolean_types,
'float': (type(1.0), ),
'long': (type(1L), ),
'tales': (type('string:3'), ),
More information about the Erp5-report
mailing list