On Tue, Jan 15, 2013 at 2:23 PM, Andrea Ambu <andrea...@gmail.com> wrote:
> Ciao! > Dunque si puo` facilmente controllare la max_age per una view cosi`: > > """"""""""" > from django.views.decorators.cache import cache_control > > @cache_control(max_age=3600) > def my_view(request): > # ... > > """"""""""" > > Ma se volessi che il valore di max_age venga deciso _dentro_ my_view come > posso fare? > > Per esempio: > """"""""""" > def my_view(request): > if is_good_to_keep_in_cache_for_a_bit(request): > # set max_age to 36000 > else: > # set max_age to 42 > # ... > """"""""""" > Boh, potresti importare patch_cache_control da django.utils.cache.py e fare: response = patch_cache_control(response, max_age=<quello che vuoi>) Oppure provare a passare una property come valore di max_age. Entrambe idee non provate: lascio al lettore l'onere della prova :-) Ciao. Marco. -- http://beri.it/ - Un blog http://beri.it/i-miei-libri/ - Qualche libro
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python