我们从Python开源项目中,提取了以下10个代码示例,用于说明如何使用werkzeug.routing.ValidationError()。
def to_python(value): try: return ObjectId(base64_decode(value)) except (InvalidId, ValueError, TypeError): raise ValidationError()
def to_python(self, value): try: return date(*(int(_) for _ in value.split('-'))) except ValueError: raise ValidationError('invalid date format')
def to_python(self, value): try: return ObjectId(value) except InvalidId: raise ValidationError('invalid id')
def to_python(self, value): if not is_address(value): raise ValidationError() value = add_0x_prefix(value) return value
def to_python(self, value): tmp = [None, None, None] for k,v in enumerate(value.split('-')): if k == 3: raise ValidationError() tmp[k]=v try: tmp[1]=int(tmp[1]) except: raise ValidationError() return tmp
def to_python(self, value): try: return from_client_participant_id(value) except BadRequest as ex: raise ValidationError(ex.description)
def to_python(self, value): intval = int(value) if not 0 < intval <= 2 ** 32: raise ValidationError() model = self.resolve_id(intval) if not model: raise ValidationError() return model
def to_python(self, value): if not validation.check_board_name_validity(value): raise ValidationError() model = board_service.find_board(value) if not model: raise ValidationError() return model
def to_python(self, value): if len(str(value)) != 2 or not str(value).isalpha(): raise ValidationError("State must be a valid two-character code.") return str(value).upper()
def to_python(self, value): if value in _USERS: return _USERS[value] raise ValidationError()