AssertionError: View function mapping is overwriting an existing endpoint function: main
def login_required(func,authority="ANY"):
def wrapper():
@wraps(func)
def decorated_view(*args, **kwargs):
if not current_user.is_authenticated:
return LoginManager.unauthorized()
if current_user.WEBUserType != 'agent':return {'message': 'Your authority is not valid.'}, 401
if authority != "customer":
if authority == 'cook' and current_user.authority == 'customer':
return {'message': 'Your authority is not valid.'}, 401
if authority == 'manager' and current_user.authority != 'manager':
return {'message': 'Your authority is not valid.'}, 401
return func(*args, **kwargs)
return decorated_view
wrapper.__name__ = func.__name__
return wrapper