Thanks for the info. As another trial, I've attempted to use this in my views:
patch_vary_headers(response, ['Cookie']) return response The behavior is the same. Pages are not caching when this variance is added. If I return all cache control back to the view, it works fine again. What am I missing in being able to use URLConf for cache_page control and add vary on cookie to the headers? On Jan 6, 4:10 am, Victor Lima <victorloureirol...@gmail.com> wrote: > Off topic side note: beware if you use vary on cookie and google > analytics, since analytics cookies changes a lot you are actually > caching views per analytics cookie change... That bugged us for a > while in our project. > > Att, > Victor Lima > > Em 05/01/2010, às 21:32, Justin L <jluz...@gmail.com> escreveu: > > > For several months, we have been caching views using the URLconf > > method (urls.py). An entry from urls.py is below as an example: > > > url(r'^(?P<path>.*)/content/(?P<id>[-\w]+)/$$', cache_page > > (hierarchies.views.category_content_detail, CACHE_TIMEOUT), > > name='category_content_detail'), > > > Recently, we had a need to add variance of cache based on cookie value > > to support some personalization features. After reading the django > > docs, it seemed easy enough to add the @vary_on_cookie decorator to > > appropriate views. > > > @vary_on_cookie > > def category_content_detail(request, path, id): > > .. > > .. > > > What I've noticed, is that since adding this vary decorator, the page > > is no longer caching, as seen by monitoring logs and seeing many > > backend processes firing which normally do not fire when the page is > > cached. > > > Any ideas on why I'd see this behavior? My browser is setting the > > cookie value appropriately, as I've monitored in Firebug, but I'm just > > not seeing any sort of caching taking place. Upon removing the > > vary_on_cookie decorator, caching returns to normal. > > > What I have noticed in testing is this. If I go back to a pure pre- > > view cache setup: > > > @vary_on_cookie > > @cache_page(60 * 15) > > def category_content_detail(request, path, id): > > > Is there a way to use vary_on_cookie with the URLconf like setup? I > > like the flexibility of the URLConf method and but also need the vary > > features. > > > Reference: > >http://docs.djangoproject.com/en/dev/topics/cache/#specifying-per-vie... > > -- > > You received this message because you are subscribed to the Google > > Groups "Django users" group. > > To post to this group, send email to django-us...@googlegroups.com. > > To unsubscribe from this group, send email to > > django-users+unsubscr...@googlegroups.com > > . > > For more options, visit this group > > athttp://groups.google.com/group/django-users?hl=en > > .
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.