cache_page decorator previously used to have optional 'key_prefix'
argument, not only timeout. Is it gone? Can I use

@cache_page(3600, key_prefix='vasia')
def my_func(request)
   ...

Another question: in 'decorator_from_middleware_with_args' docstring
example stated:
Use like::

    cache_page = decorator_from_middleware(CacheMiddleware)

Is it correct?

Or maybe I've missed something?

Please excuse my English :)

On 22 сен, 08:04, Luke Plant <l.plant...@cantab.net> wrote:
> On Monday 21 September 2009 20:27:50 Jacob Kaplan-Moss wrote:
>
> > On Mon, Sep 21, 2009 at 1:21 PM, Luke Plant <l.plant...@cantab.net> wrote:
> > > However, decorator_from_middleware is a pain, since it doesn't always
> > > return a an actual decorator, for "historical reasons".  I need to change
> > > this to fix the bug.  Is anyone against this?
>
> > No, I think this is precisely correct. I've been meaning to do exactly
> > what you're proposing for a while myself; just haven't gotten around
> > to it.
>
> > > decorator_from_middleware isn't actually documented anywhere
>
> > I actually avoided documenting it because it's broken. Once you fix
> > it, we should (i.e. I will, if you don't have time) document it.
>
> I've committed my change [1], and also replaced _CheckLogin with my method [2]
> (it was essentially the same method, just generalised).
>
> I haven't added any docs, because I'm not sure it's perfect yet (and also
> because I am lazy and I was mainly working on something else, this just got in
> the way).  In the 'normal' case where you don't need to pass any args to the
> middleware, it is exactly the same (but works for decorating methods now).  In
> the abnormal case, you have to use decorator_from_middleware_with_args, which
> is a pretty ugly name, if explicit.  I don't know if you had other ideas about
> what to do with this.  Changing that name is easy, it's only used by
> cache_page.
>
> Luke
>
> [1]http://code.djangoproject.com/changeset/11586
> [2]http://code.djangoproject.com/changeset/11587
>
> --
> Parenthetical remarks (however relevant) are unnecessary
>
> Luke Plant ||http://lukeplant.me.uk/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to