* Fix typos

* Downgrade mistune version

* Fix blueprint host param

Co-authored-by: Adam Hopkins <admhpkns@gmail.com>
Co-authored-by: Adam Hopkins <adam@amhopkins.com>
This commit is contained in:
Kian Meng Ang 2021-12-06 15:17:01 +08:00 committed by GitHub
parent cf3c205fa5
commit ab35121864
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 17 additions and 16 deletions

View File

@ -657,7 +657,7 @@ Improved Documentation
Version 20.6.0 Version 20.6.0
--------------- ---------------
*Released, but unintentionally ommitting PR #1880, so was replaced by 20.6.1* *Released, but unintentionally omitting PR #1880, so was replaced by 20.6.1*
Version 20.3.0 Version 20.3.0
@ -1090,7 +1090,7 @@ Version 18.12
* Fix Range header handling for static files (#1402) * Fix Range header handling for static files (#1402)
* Fix the logger and make it work (#1397) * Fix the logger and make it work (#1397)
* Fix type pikcle->pickle in multiprocessing test * Fix type pikcle->pickle in multiprocessing test
* Fix pickling blueprints Change the string passed in the "name" section of the namedtuples in Blueprint to match the name of the Blueprint module attribute name. This allows blueprints to be pickled and unpickled, without errors, which is a requirment of running Sanic in multiprocessing mode in Windows. Added a test for pickling and unpickling blueprints Added a test for pickling and unpickling sanic itself Added a test for enabling multiprocessing on an app with a blueprint (only useful to catch this bug if the tests are run on Windows). * Fix pickling blueprints Change the string passed in the "name" section of the namedtuples in Blueprint to match the name of the Blueprint module attribute name. This allows blueprints to be pickled and unpickled, without errors, which is a requirement of running Sanic in multiprocessing mode in Windows. Added a test for pickling and unpickling blueprints Added a test for pickling and unpickling sanic itself Added a test for enabling multiprocessing on an app with a blueprint (only useful to catch this bug if the tests are run on Windows).
* Fix document for logging * Fix document for logging
Version 0.8 Version 0.8
@ -1129,7 +1129,7 @@ Version 0.8
* Content-length header on 204/304 responses (Arnulfo Solís) * Content-length header on 204/304 responses (Arnulfo Solís)
* Extend WebSocketProtocol arguments and add docs (Bob Olde Hampsink, yunstanford) * Extend WebSocketProtocol arguments and add docs (Bob Olde Hampsink, yunstanford)
* Update development status from pre-alpha to beta (Maksim Anisenkov) * Update development status from pre-alpha to beta (Maksim Anisenkov)
* KeepAlive Timout log level changed to debug (Arnulfo Solís) * KeepAlive Timeout log level changed to debug (Arnulfo Solís)
* Pin pytest to 3.3.2 because of pytest-dev/pytest#3170 (Maksim Aniskenov) * Pin pytest to 3.3.2 because of pytest-dev/pytest#3170 (Maksim Aniskenov)
* Install Python 3.5 and 3.6 on docker container for tests (Shahin Azad) * Install Python 3.5 and 3.6 on docker container for tests (Shahin Azad)
* Add support for blueprint groups and nesting (Elias Tarhini) * Add support for blueprint groups and nesting (Elias Tarhini)

View File

@ -23,7 +23,7 @@ def key_exist_handler(request):
if hasattr(request.ctx, "num"): if hasattr(request.ctx, "num"):
return text("num exist in request") return text("num exist in request")
return text("num does not exist in reqeust") return text("num does not exist in request")
app.run(host="0.0.0.0", port=8000, debug=True) app.run(host="0.0.0.0", port=8000, debug=True)

View File

@ -337,7 +337,7 @@ class Sanic(BaseSanic, metaclass=TouchUpMeta):
""" """
Method for attaching middleware to specific routes. This is mainly an Method for attaching middleware to specific routes. This is mainly an
internal tool for use by Blueprints to attach middleware to only its internal tool for use by Blueprints to attach middleware to only its
specfic routes. But, it could be used in a more generalized fashion. specific routes. But, it could be used in a more generalized fashion.
:param middleware: the middleware to execute :param middleware: the middleware to execute
:param route_names: a list of the names of the endpoints :param route_names: a list of the names of the endpoints

View File

@ -79,7 +79,7 @@ class Blueprint(BaseSanic):
:param name: unique name of the blueprint :param name: unique name of the blueprint
:param url_prefix: URL to be prefixed before all route URLs :param url_prefix: URL to be prefixed before all route URLs
:param host: IP Address of FQDN for the sanic server to use. :param host: IP Address or FQDN for the sanic server to use.
:param version: Blueprint Version :param version: Blueprint Version
:param strict_slashes: Enforce the API urls are requested with a :param strict_slashes: Enforce the API urls are requested with a
trailing */* trailing */*
@ -112,7 +112,7 @@ class Blueprint(BaseSanic):
self, self,
name: str = None, name: str = None,
url_prefix: Optional[str] = None, url_prefix: Optional[str] = None,
host: Optional[str] = None, host: Optional[Union[List[str], str]] = None,
version: Optional[Union[int, str, float]] = None, version: Optional[Union[int, str, float]] = None,
strict_slashes: Optional[bool] = None, strict_slashes: Optional[bool] = None,
version_prefix: str = "/v", version_prefix: str = "/v",

View File

@ -28,7 +28,7 @@ _host_re = re.compile(
# RFC's quoted-pair escapes are mostly ignored by browsers. Chrome, Firefox and # RFC's quoted-pair escapes are mostly ignored by browsers. Chrome, Firefox and
# curl all have different escaping, that we try to handle as well as possible, # curl all have different escaping, that we try to handle as well as possible,
# even though no client espaces in a way that would allow perfect handling. # even though no client escapes in a way that would allow perfect handling.
# For more information, consult ../tests/test_requests.py # For more information, consult ../tests/test_requests.py

View File

@ -144,7 +144,7 @@ def import_string(module_name, package=None):
import a module or class by string path. import a module or class by string path.
:module_name: str with path of module or path to import and :module_name: str with path of module or path to import and
instanciate a class instantiate a class
:returns: a module object or one instance from class if :returns: a module object or one instance from class if
module_name is a valid path to class module_name is a valid path to class

View File

@ -54,7 +54,7 @@ class Router(BaseRouter):
self, path: str, method: str, host: Optional[str] self, path: str, method: str, host: Optional[str]
) -> Tuple[Route, RouteHandler, Dict[str, Any]]: ) -> Tuple[Route, RouteHandler, Dict[str, Any]]:
""" """
Retrieve a `Route` object containg the details about how to handle Retrieve a `Route` object containing the details about how to handle
a response for a given request a response for a given request
:param request: the incoming request object :param request: the incoming request object

View File

@ -175,7 +175,7 @@ def match_hostname(
def selector_sni_callback( def selector_sni_callback(
sslobj: ssl.SSLObject, server_name: str, ctx: CertSelector sslobj: ssl.SSLObject, server_name: str, ctx: CertSelector
) -> Optional[int]: ) -> Optional[int]:
"""Select a certificate mathing the SNI.""" """Select a certificate matching the SNI."""
# Call server_name_callback to store the SNI on sslobj # Call server_name_callback to store the SNI on sslobj
server_name_callback(sslobj, server_name, ctx) server_name_callback(sslobj, server_name, ctx)
# Find a new context matching the hostname # Find a new context matching the hostname

View File

@ -48,7 +48,7 @@ def load_module_from_file_location(
"""Returns loaded module provided as a file path. """Returns loaded module provided as a file path.
:param args: :param args:
Coresponds to importlib.util.spec_from_file_location location Corresponds to importlib.util.spec_from_file_location location
parameters,but with this differences: parameters,but with this differences:
- It has to be of a string or bytes type. - It has to be of a string or bytes type.
- You can also use here environment variables - You can also use here environment variables
@ -58,10 +58,10 @@ def load_module_from_file_location(
If location parameter is of a bytes type, then use this encoding If location parameter is of a bytes type, then use this encoding
to decode it into string. to decode it into string.
:param args: :param args:
Coresponds to the rest of importlib.util.spec_from_file_location Corresponds to the rest of importlib.util.spec_from_file_location
parameters. parameters.
:param kwargs: :param kwargs:
Coresponds to the rest of importlib.util.spec_from_file_location Corresponds to the rest of importlib.util.spec_from_file_location
parameters. parameters.
For example You can: For example You can:

View File

@ -310,7 +310,7 @@ if __name__ == "__main__":
cli.add_argument( cli.add_argument(
"--milestone", "--milestone",
"-ms", "-ms",
help="Git Release milestone information to include in relase note", help="Git Release milestone information to include in release note",
required=False, required=False,
) )
cli.add_argument( cli.add_argument(

View File

@ -121,6 +121,7 @@ docs_require = [
"docutils", "docutils",
"pygments", "pygments",
"m2r2", "m2r2",
"mistune<2.0.0",
] ]
dev_require = tests_require + [ dev_require = tests_require + [

View File

@ -17,7 +17,7 @@ def test_custom_context(app):
@app.route("/") @app.route("/")
def handler(request): def handler(request):
# Accessing non-existant key should fail with AttributeError # Accessing non-existent key should fail with AttributeError
try: try:
invalid = request.ctx.missing invalid = request.ctx.missing
except AttributeError as e: except AttributeError as e: