squash
This commit is contained in:
parent
973c315790
commit
a498c29ec9
5
Makefile
5
Makefile
@ -70,7 +70,10 @@ endif
|
|||||||
black:
|
black:
|
||||||
black --config ./.black.toml sanic tests
|
black --config ./.black.toml sanic tests
|
||||||
|
|
||||||
pretty: beautify
|
isort:
|
||||||
|
isort sanic tests --profile=black
|
||||||
|
|
||||||
|
pretty: black isort
|
||||||
|
|
||||||
docs-clean:
|
docs-clean:
|
||||||
cd docs && make clean
|
cd docs && make clean
|
||||||
|
@ -19,8 +19,6 @@ class HTTPMethodView:
|
|||||||
def put(self, request, *args, **kwargs):
|
def put(self, request, *args, **kwargs):
|
||||||
return text('I am put method')
|
return text('I am put method')
|
||||||
|
|
||||||
etc.
|
|
||||||
|
|
||||||
If someone tries to use a non-implemented method, there will be a
|
If someone tries to use a non-implemented method, there will be a
|
||||||
405 response.
|
405 response.
|
||||||
|
|
||||||
@ -33,8 +31,9 @@ class HTTPMethodView:
|
|||||||
return text('I am get method with %s' % my_param_here)
|
return text('I am get method with %s' % my_param_here)
|
||||||
|
|
||||||
To add the view into the routing you could use
|
To add the view into the routing you could use
|
||||||
1) app.add_route(DummyView.as_view(), '/')
|
|
||||||
2) app.route('/')(DummyView.as_view())
|
1) ``app.add_route(DummyView.as_view(), '/')``, OR
|
||||||
|
2) ``app.route('/')(DummyView.as_view())``
|
||||||
|
|
||||||
To add any decorator you could set it into decorators variable
|
To add any decorator you could set it into decorators variable
|
||||||
"""
|
"""
|
||||||
@ -78,12 +77,13 @@ class CompositionView:
|
|||||||
for every HTTP method you want to support.
|
for every HTTP method you want to support.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
view = CompositionView()
|
view = CompositionView()
|
||||||
view.add(['GET'], lambda request: text('I am get method'))
|
view.add(['GET'], lambda request: text('I am get method'))
|
||||||
view.add(['POST', 'PUT'], lambda request: text('I am post/put method'))
|
view.add(['POST', 'PUT'], lambda request: text('I am post/put method'))
|
||||||
|
|
||||||
etc.
|
|
||||||
|
|
||||||
If someone tries to use a non-implemented method, there will be a
|
If someone tries to use a non-implemented method, there will be a
|
||||||
405 response.
|
405 response.
|
||||||
"""
|
"""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user