diff -r da2f0d5221d8 -r 509e30b9f5c9 web/ldt/ldt_utils/utils.py --- a/web/ldt/ldt_utils/utils.py Fri Aug 27 08:25:18 2010 +0200 +++ b/web/ldt/ldt_utils/utils.py Wed Sep 01 09:50:05 2010 +0200 @@ -14,6 +14,23 @@ import Ft import lxml.etree +__BOOLEAN_DICT = { + 'false':False, + 'true':True, + '0':False, + '1':True, + 't': True, + 'f':False +} + +def boolean_convert(bool): + if bool is None: + return False + if bool is True or bool is False: + return bool + key = str(bool).lower() + return __BOOLEAN_DICT.get(key, False) + class LdtSearch(object): def query(self, field, query):