Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

How to use more then one route on the same view function? #21

Closed
kinorsi opened this issue May 27, 2014 · 1 comment
Closed

How to use more then one route on the same view function? #21

kinorsi opened this issue May 27, 2014 · 1 comment

Comments

@kinorsi
Copy link

kinorsi commented May 27, 2014

Currently, a view function only has one route. @route(bp, '/someurl', methods=['GET']). e.g. But how about if I need more then one url mapping for the same view function?

@kinorsi
Copy link
Author

kinorsi commented May 27, 2014

My current solution:
#------------------------------

def route(bp, *args, **kwargs):
    def decorator(f):
        @wraps(f)
        def wrapper(*args, **kwargs):
            return f(*args, **kwargs)
        fun = wrapper
        for arg in args:
            fun = bp.route(arg, **kwargs)(fun)
        return fun
    return decorator

@kinorsi kinorsi closed this as completed May 27, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant