Browse Source

Added module support to templated decorator.

pull/1638/head
Armin Ronacher 15 years ago
parent
commit
7e1db5978c
  1. 11
      docs/patterns/viewdecorators.rst

11
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 = {}

Loading…
Cancel
Save