On Thu, 2006-05-11 at 21:27 +0100, Graham King wrote: > When trying to cache a page using the cache_page decorator, it doesn't > seem to work when passing a time with the python 2.4 syntax. > > This works: > > @cache_page > def index(request): > do stuff > > As does this: > > def index(request): > do stuff > index = cache_page(index, 60 * 60) > > But this doesn't: > > @cache_page(60 * 60): > def index(request): > do stuff > > yet that is the example given here: > http://www.djangoproject.com/documentation/cache/#the-per-view-cache > > It seems to pass the time as the first parameter, where the function > should be. > > Has anyone else had this problem ? It might well be my limited > understanding of decorators, or simply a change needed in the docs.
The docs don't look right. In python 2.4, this: @decor(x) def g(y): .... is equivalent to g = decor(x)(g), not g = decor(g, x). I'll have a look at what's going on in the code (cache decorators are created in a slightly tricky fashion in Django). For the time being, don't do that. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---