Merge pull request #1546 from krigar1184/master
Fixed a docstring typo and simplified code a little
This commit is contained in:
commit
d58151a0eb
33
sanic/app.py
33
sanic/app.py
|
@ -180,27 +180,28 @@ class Sanic:
|
||||||
strict_slashes = self.strict_slashes
|
strict_slashes = self.strict_slashes
|
||||||
|
|
||||||
def response(handler):
|
def response(handler):
|
||||||
args = [key for key in signature(handler).parameters.keys()]
|
args = list(signature(handler).parameters.keys())
|
||||||
if args:
|
|
||||||
if stream:
|
|
||||||
handler.is_stream = stream
|
|
||||||
|
|
||||||
self.router.add(
|
if not args:
|
||||||
uri=uri,
|
|
||||||
methods=methods,
|
|
||||||
handler=handler,
|
|
||||||
host=host,
|
|
||||||
strict_slashes=strict_slashes,
|
|
||||||
version=version,
|
|
||||||
name=name,
|
|
||||||
)
|
|
||||||
return handler
|
|
||||||
else:
|
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Required parameter `request` missing "
|
"Required parameter `request` missing "
|
||||||
"in the {0}() route?".format(handler.__name__)
|
"in the {0}() route?".format(handler.__name__)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if stream:
|
||||||
|
handler.is_stream = stream
|
||||||
|
|
||||||
|
self.router.add(
|
||||||
|
uri=uri,
|
||||||
|
methods=methods,
|
||||||
|
handler=handler,
|
||||||
|
host=host,
|
||||||
|
strict_slashes=strict_slashes,
|
||||||
|
version=version,
|
||||||
|
name=name,
|
||||||
|
)
|
||||||
|
return handler
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
# Shorthand method decorators
|
# Shorthand method decorators
|
||||||
|
@ -332,7 +333,7 @@ class Sanic:
|
||||||
name=None,
|
name=None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Add an API URL under the **DELETE** *HTTP* method
|
Add an API URL under the **PATCH** *HTTP* method
|
||||||
|
|
||||||
:param uri: URL to be tagged to **PATCH** method of *HTTP*
|
:param uri: URL to be tagged to **PATCH** method of *HTTP*
|
||||||
:param host: Host IP or FQDN for the service to use
|
:param host: Host IP or FQDN for the service to use
|
||||||
|
|
Loading…
Reference in New Issue
Block a user