def validation(object): value = object.get(name, None) if value == None: return True if len(value) < size: return True raise exceptions.ValidationInternalError( name, "must be smaller than %d characters" % size )
def validation(object): first_value = object.get(first_name, None) second_value = object.get(second_name, None) if first_value == None: return True if second_value == None: return True if first_value == second_value: return True raise exceptions.ValidationInternalError( first_name, "value is not equals to %s" % second_name )
def validation(object): _id = object.get("_id", None) value = object.get(name, None) if value == None: return True db = mongodb.get_db() _collection = db[collection] item = _collection.find_one({name : value}) if not item: return True if str(item["_id"]) == _id: return True raise exceptions.ValidationInternalError(name, "value is duplicate")
def validation(object): value = object.get(name, None) if value == None: return True if URL_REGEX.match(value): return True raise exceptions.ValidationInternalError(name, "value is not a valid url")
def validation(object): value = object.get(name, None) if value == None: return True if value in values: return True raise exceptions.ValidationInternalError(name, "value is not in set")
def validation(object): value = object.get(name, None) if value == None: return True if len(value): return True raise exceptions.ValidationInternalError(name, "value is empty")