thanks jeremy.

answer to "what isn´t working":
on the top of each page, we have two links which depend on whether the
user is authenticated or not.
either: username / logout (if authenticated)
or: login / register (if not authenticated)

when I use cache_page (with or without patch_vary_headers resp.
vary_on_headers('Cookie')) my username is still displayed when I´m
logged out (and also the other way round).

patrick.

On 29 Aug., 17:33, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
> It's clear to me that the docs involving patch_vary_header, cache_page
> and the cache middleware need to be improved.
>
> I'm using this thread as proof.  :)
>
> The cache_page decorator is actually just a wrapper around the cache
> middleware; think of it as view-specific application ofthe cache
> middleware.
>
> In any case, the patch_vary_headers *should* work with the cache_page
> decorator; the decorator forms the cache key based on the response.
> This is a separate problem from the unicode issue.
>
> Can you provide any info on what isn't working as expected with the
> patch_vary_headers call?
>
> On 8/29/07, patrickk <[EMAIL PROTECTED]> wrote:
>
>
>
> > I´ve been too optimistic - the above code doesn´t work.
> > (This whole caching-issue gives me the willies)
>
> > On 29 Aug., 12:21, patrickk <[EMAIL PROTECTED]> wrote:
> > > it´s a bit late, but I just wanted to tell that it works with
> > > patch_vary_headers.
> > > in my opinion, this could be explained better in the docs.
>
> > > so, if one uses a page based on user-authentication and wants to cache
> > > that page using the cache_page decorator, here´s the code:
>
> > > def my_view(request):
> > >     ....
>
> > >     response = render_to_response('site/whatever/template.html', {
> > >         ...
> > >     }, context_instance=RequestContext(request) )
> > >     patch_vary_headers(response, ['Cookie'])
> > >     return response
> > > my_view = cache_page(may_view, 60 * 15)
>
> > > thanks,
> > > patrick
>
> > > On 8 Jul., 01:18, "Jeremy Dunck" <[EMAIL PROTECTED]> wrote:
>
> > > > On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote:
>
> > > > > I don´t understand why the page_cache is keyed by the vary header and
> > > > > the view_cache is not. is there a reason for this?
>
> > > > You mean cache_page rather than page_cache, but what is view_cache?
>
> > > > I think I may have spotted the problem: the cache_page decorator runs
> > > > before the Vary header gets patched for the session access.
>
> > > > As a test, just before you return your HttpResponse, try adding this
> > > > to one of your auth views, and try to use the cache_page decorator:
>
> > > > from django.utils.cacheimport patch_vary_headers
> > > > patch_vary_headers(response, ('Cookie',))
>
> > > > (Maye sure to dump yourcachefirst, too.)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to