squash
This commit is contained in:
parent
973c315790
commit
a498c29ec9
5
Makefile
5
Makefile
|
@ -70,7 +70,10 @@ endif
|
|||
black:
|
||||
black --config ./.black.toml sanic tests
|
||||
|
||||
pretty: beautify
|
||||
isort:
|
||||
isort sanic tests --profile=black
|
||||
|
||||
pretty: black isort
|
||||
|
||||
docs-clean:
|
||||
cd docs && make clean
|
||||
|
|
|
@ -19,8 +19,6 @@ class HTTPMethodView:
|
|||
def put(self, request, *args, **kwargs):
|
||||
return text('I am put method')
|
||||
|
||||
etc.
|
||||
|
||||
If someone tries to use a non-implemented method, there will be a
|
||||
405 response.
|
||||
|
||||
|
@ -33,8 +31,9 @@ class HTTPMethodView:
|
|||
return text('I am get method with %s' % my_param_here)
|
||||
|
||||
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
|
||||
"""
|
||||
|
@ -78,12 +77,13 @@ class CompositionView:
|
|||
for every HTTP method you want to support.
|
||||
|
||||
For example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
view = CompositionView()
|
||||
view.add(['GET'], lambda request: text('I am get 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
|
||||
405 response.
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user