First try at adding HTTP method decorators.
This commit is contained in:
parent
325b96099a
commit
80cd265e7e
1 changed files with 12 additions and 0 deletions
12
flask/app.py
12
flask/app.py
|
|
@ -604,6 +604,18 @@ class Flask(_PackageBoundObject):
|
|||
return f
|
||||
return decorator
|
||||
|
||||
def get(self, rule, **options):
|
||||
def decorator(f):
|
||||
self.add_url_rule(rule, None, f, methods=('GET',), **options)
|
||||
return f
|
||||
return decorator
|
||||
|
||||
def post(self, rule, **options):
|
||||
def decorator(f):
|
||||
self.add_url_rule(rule, None, f,methods=('POST',), **options)
|
||||
return f
|
||||
return decorator
|
||||
|
||||
def errorhandler(self, code):
|
||||
"""A decorator that is used to register a function give a given
|
||||
error code. Example::
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue