Maybe my question is wrong because of some background that I'm not seeing.
Due to the structure of my app, I use @cache.action like this in all my
controller functions:
@cache.action(cache_model=CACHE.model, time_expire=CACHE.time_expire,
session=CACHE.session, vars=CACHE.vars, public=CACHE.public)
def index():
# code here
In my model, I define the CACHE object with the proper attributes,
depending on several situations (logged in or not, certain permissions,
specific scenarios). The thing is that, *in some cases I need to set the
response headers as if I hadn't use @cache.action*. I've tried to set
cache_model=None and time_expire=None, but it throws the following error:
Traceback (most recent call last):
File "/home/gonguinguen/medios/gluon/restricted.py", line 227, in restricted
exec ccode in environment
File "/home/gonguinguen/medios/applications/mazar/controllers/default.py",
line 463, in <module>
File "/home/gonguinguen/medios/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "/home/gonguinguen/medios/gluon/cache.py", line 669, in wrapped_f
'Expires': expires,
UnboundLocalError: local variable 'expires' referenced before assignment
I mean, if I dont use @cache.action, then Cache-Control header has the
following value:
no-store, no-cache, must-revalidate, post-check=0, pre-check=0
But I can't generate that same response header using @cache.action.
Wouldn't be nice if we could pass time_expire=0 and cache_model=None to set
those headers?
In anycase, how can I solve it? Would I need a custom decorator? Would it
be possible to instantiate and rewrite the default cache.action behaviour?
Thanks in advance!
Regards,
Lisandro
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.