#NEWLINE# def __init__( self , value , strip = True , * args , **kw ) : #NEWLINE# #INDENT# 'Initialisation\n\n        Check that the value is a bool\n\n        In:\n          - ``v`` -- value to validate\n        ' #NEWLINE# try : #NEWLINE# #INDENT# if isinstance ( args , basestring ) : #NEWLINE# #INDENT# value = value . strip ( ) #NEWLINE# if ( value . lower ( ) in ( 'yes' , 'on' , 'true' , '1' ) ) : #NEWLINE# #INDENT# self . value = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( value . lower ( ) in ( 'no' , 'off' , 'false' , '0' ) ) : #NEWLINE# #INDENT# self . value = False #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . value = False #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . value = bool ( value ) #NEWLINE# #UNINDENT# #UNINDENT# except ( ValueError , TypeError ) : #NEWLINE# #INDENT# raise ValueError ( i18n . _ ( 'Must be a boolean' ) )