P5-4418 validate Pwinty SKU code
This commit is contained in:
@@ -94,3 +94,22 @@ def validate_territory(*keys):
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
|
||||
def validate_any_of(key, values):
|
||||
def decorator(f):
|
||||
@wraps(f)
|
||||
def wrapper(*args, **kwargs):
|
||||
_check_parameter_exists(key)
|
||||
value = request.args.get(key)
|
||||
if not value in values:
|
||||
raise ValidationError(
|
||||
"{} contains an invalid value, must be one of: {}".format(
|
||||
key, values
|
||||
)
|
||||
)
|
||||
return f(*args, **kwargs)
|
||||
|
||||
return wrapper
|
||||
|
||||
return decorator
|
||||
|
||||
Reference in New Issue
Block a user