Commit 31d05df8 authored by Jérome Perrin's avatar Jérome Perrin

handle boolean type if supported by python



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10162 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e9ed5e76
...@@ -31,6 +31,11 @@ ...@@ -31,6 +31,11 @@
from Constraint import Constraint from Constraint import Constraint
from DateTime import DateTime from DateTime import DateTime
try:
boolean_types = (type(1), type(True))
except NameError:
boolean_types = (type(1), )
class PropertyTypeValidity(Constraint): class PropertyTypeValidity(Constraint):
""" """
This constraint class allows to check / fix type of each This constraint class allows to check / fix type of each
...@@ -43,7 +48,7 @@ class PropertyTypeValidity(Constraint): ...@@ -43,7 +48,7 @@ class PropertyTypeValidity(Constraint):
'string': (type('a'), ), 'string': (type('a'), ),
'text': (type('a'), ), 'text': (type('a'), ),
'int': (type(1), ), 'int': (type(1), ),
'boolean': (type(1), ), 'boolean': boolean_types,
'float': (type(1.0), ), 'float': (type(1.0), ),
'long': (type(1L), ), 'long': (type(1L), ),
'tales': (type('string:3'), ), 'tales': (type('string:3'), ),
......
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