request.url_vars property, closes #822

This commit is contained in:
Simon Willison 2020-06-08 20:40:00 -07:00
commit fac8e93815
5 changed files with 28 additions and 4 deletions

View file

@ -850,8 +850,8 @@ Return a list of ``(regex, async_view_function)`` pairs, something like this:
import html
async def hello_from(scope):
name = scope["url_route"]["kwargs"]["name"]
async def hello_from(request):
name = request.url_vars["name"]
return Response.html("Hello from {}".format(
html.escape(name)
))