Am 07.07.2007 um 19:36 schrieb Honza Král:
> On 7/7/07, patrick k. <[EMAIL PROTECTED]> wrote: >> >> >> Am 07.07.2007 um 02:13 schrieb Jeremy Dunck: >> >>> >>> On 7/6/07, patrickk <[EMAIL PROTECTED]> wrote: >>>> >>>> when having a header where the username and a logout-button is >>>> displayed, how do you cache this page/view? >>> >>> There's a CACHE_MIDDLEWARE_ANONYMOUS_ONLY setting if you want to >>> only >>> do anonymous caching. >>> >>> But I think you must have your cache middleware in the wrong >>> order if >>> you're seeing this problem. >> >> I�m not using the cache middleware. >> >>> >>> page_cache and the cache middleware both are keyed by the Vary >>> header, >>> and the Vary header will contain 'Cookie' if you've accessed the >>> session object-- which you must have done if you have the >>> request.user >>> in your template. >> >> I�m currently using the per-view cache (well, actually I�m >> using the >> low-level cache because of the mentioned problems). >> >> I�d like to cache individual views - the only thing changing is the >> header (either "username/logout" or "login/register"), everything >> else is the same. > > if its that case, you could write your own middleware that would > rewrite the page - just put some placeholder where this information is > supposed to go, and let the middleware handle it I have to check that ... currently, I´ve no idea how this could be done (but I guess the docs will tell me). > > OR > > do not cache the entire page, but rather some reusable blocks or > data... that was the initial question. when caching part of the page, I have to render the templates twice. first render the cached part and then the dynamic part. this leads to strange templates though (because I´m caching the whole page except for one line of code). 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? thanks, patrick > >> >> thanks, >> patrick >> >> >>> >>> Please post your MIDDLEWARE_CLASSES tuple. >>> >>>> is this (using the low-level cache) the best way doing this? >>>> >>> >>> I'm not convinced you need it. >>> >>>> >> >> >>> >> > > > -- > Honza Kr�l > E-Mail: [EMAIL PROTECTED] > ICQ#: 107471613 > Phone: +420 606 678585 > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---