Good point. You can also use response.render(), which may be a bit simpler:
mytext = cache.ram('mytext',
lambda: response.render('path/to/template.html'),
time_expire=3600)
The path must be relative to the app's /views folder (you can use ../ to
get out of t
You can use the render() function:
import os
from gluon.template import render
mytext = cache.ram('mytext',
lambda: render(filename=os.path.join(request.folder,
'path', 'to', 'template.html')),
time_expire=3600)
If the template contains any {{include ...}} d
response.render is what you're seeking for ...
On Friday, November 8, 2013 3:49:14 AM UTC+1, Scott Hunter wrote:
>
> Is it possible to use a view to generate a string? In this particular
> case, I want to generate a snippet of HTML & cache it away. I suppose this
> could be done using straigh
I think what you want is a controller with a cached view, if it is then,
check the example in the book
http://web2py.com/book/default/chapter/04#cache for cache/view.
Of course that if you explain more thoroughly what you are trying to do,
other options may be better.
Sexta-feira, 8 de Novem
4 matches
Mail list logo