def check(self,arg): """ Verfies the argument is a boolean (using utils.convert_boolean function) and converts it to a boolean value (0 or 1). @param arg: the argument to check the type-hood and convert @type arg: string @returns: the converted argument @rtype: int (0 or 1) @raises ParserException: if the arg is not a valid boolean """ ret = utils.convert_boolean(arg) if ret == 1 or ret == 0: return ret raise ParserException("Invalid boolean value specified: %s" % (arg))
def check(self, arg): """ Verfies the argument is a boolean (using utils.convert_boolean function) and converts it to a boolean value (0 or 1). @param arg: the argument to check the type-hood and convert @type arg: string @returns: the converted argument @rtype: int (0 or 1) @raises ParserException: if the arg is not a valid boolean """ ret = utils.convert_boolean(arg) if ret == 1 or ret == 0: return ret raise ParserException("Invalid boolean value specified: %s" % (arg))
def check(self,arg): """ Verfies the argument is a boolean (using utils.convert_boolean function) and converts it to a boolean value (0 or 1). Also handles None, "-" and the empty string as None. @param arg: the argument to check the type-hood and convert @type arg: string @returns: the converted argument @rtype: int (0 or 1) or None @raises ParserException: if the arg is not a valid boolean """ ret = utils.convert_boolean(arg) if ret == 1 or ret == 0: return ret elif arg == "None" or arg == "-" or arg == "": return None else: raise ParserException, "Invalid boolean value specified: %s" % (arg)
def check(self, arg): """ Verfies the argument is a boolean (using utils.convert_boolean function) and converts it to a boolean value (0 or 1). Also handles None, "-" and the empty string as None. @param arg: the argument to check the type-hood and convert @type arg: string @returns: the converted argument @rtype: int (0 or 1) or None @raises ParserException: if the arg is not a valid boolean """ ret = utils.convert_boolean(arg) if ret == 1 or ret == 0: return ret elif arg == "None" or arg == "-" or arg == "": return None else: raise ParserException, "Invalid boolean value specified: %s" % ( arg)