From 234a7925c611e8f80b94dc183f1f4d86b40a8a84 Mon Sep 17 00:00:00 2001 From: Tim Mundt Date: Fri, 16 Dec 2016 18:51:44 +0100 Subject: [PATCH] restored accidentally degraded doc string --- sanic/config.py | 2 +- sanic/router.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sanic/config.py b/sanic/config.py index feb3b484..f7db0465 100644 --- a/sanic/config.py +++ b/sanic/config.py @@ -54,7 +54,7 @@ class Config(dict): def from_pyfile(self, filename): """Updates the values in the config from a Python file. Only the uppercase - varibales in that module are stored in the config. + variables in that module are stored in the config. :param filename: an absolute path to the config file """ module = types.ModuleType('config') diff --git a/sanic/router.py b/sanic/router.py index 29bebc3e..2045dfe1 100644 --- a/sanic/router.py +++ b/sanic/router.py @@ -31,11 +31,17 @@ class Router: @sanic.route('/my/url/', methods=['GET', 'POST', ...]) def my_route(request, my_parameter): do stuff... + or + @sanic.route('/my/url/:type', methods['GET', 'POST', ...]) + def my_route_with_type(request, my_parameter): + do stuff... Parameters will be passed as keyword arguments to the request handling - function provided Parameters can also have a type by appending :type to - the . If no type is provided, a string is expected. A regular - expression can also be passed in as the type + function. Provided parameters can also have a type by appending :type to + the . Given parameter must be able to be type-casted to this. + If no type is provided, a string is expected. A regular expression can + also be passed in as the type. The argument given to the function will + always be a string, independent of the type. """ routes_static = None routes_dynamic = None