From 7e1db5978c3c7aedcb43d7e2036edc85b0a22a6b Mon Sep 17 00:00:00 2001 From: Armin Ronacher Date: Sun, 2 May 2010 12:11:04 +0200 Subject: [PATCH] Added module support to templated decorator. --- docs/patterns/viewdecorators.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/docs/patterns/viewdecorators.rst b/docs/patterns/viewdecorators.rst index f777a294..49620ff8 100644 --- a/docs/patterns/viewdecorators.rst +++ b/docs/patterns/viewdecorators.rst @@ -117,10 +117,10 @@ three examples do exactly the same:: return dict(value=42) As you can see, if no template name is provided it will use the endpoint -of the URL map + ``'.html'``. Otherwise the provided template name is -used. When the decorated function returns, the dictionary returned is -passed to the template rendering function. If `None` is returned, an -empty dictionary is assumed. +of the URL map with dots converted to slashes + ``'.html'``. Otherwise +the provided template name is used. When the decorated function returns, +the dictionary returned is passed to the template rendering function. If +`None` is returned, an empty dictionary is assumed. Here the code for that decorator:: @@ -133,7 +133,8 @@ Here the code for that decorator:: def decorated_function(*args, **kwargs): template_name = template if template_name is None: - template_name = request.endpoint + '.html' + template_name = request.endpoint \ + .replace('.', '/') + '.html' ctx = f(*args, **kwargs) if ctx is None: ctx = {}