From 31d05df8503fccc43c327f41f045eab8c9e89385 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9rome=20Perrin?= <jerome@nexedi.com>
Date: Tue, 19 Sep 2006 12:41:08 +0000
Subject: [PATCH] handle boolean type if supported by python

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10162 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 product/ERP5Type/Constraint/PropertyTypeValidity.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/product/ERP5Type/Constraint/PropertyTypeValidity.py b/product/ERP5Type/Constraint/PropertyTypeValidity.py
index 3e9df5dc00..8848f7eaae 100644
--- a/product/ERP5Type/Constraint/PropertyTypeValidity.py
+++ b/product/ERP5Type/Constraint/PropertyTypeValidity.py
@@ -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 @@ class PropertyTypeValidity(Constraint):
     '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'), ),
-- 
2.30.9