[Zope-CMF] CachingPolicy

Dieter Maurer dieter at handshake.de
Thu Jun 22 14:00:39 EDT 2006


LESUEUR Frédéric wrote at 2006-6-22 15:08 +0200:
>i have a question about the "_setCacheHeaders" methods inside this
>file CMFCore/utils.py.
>
>Why content is set to aq_parent and not the object itself ?

The model (underlying the caching policy manager) is that
templates (views) access content objects.

In the code above "object" is (usually) the template,
"object.aq_parent" is the object viewed by the template -- i.e.
the content object in the model above.


You are right that the model often does not fit: it does not,
e.g. for "FSFile" and "FSImage" objects (now fixed in the core).

But it also does not fit when the template is used in
its own right and not as a view, e.g. a FSDTMLMethod generating
a style sheet.


The model mentioned above it too narrow. It should be extended
by an additional variable "target" (or something similar)
which is the object traversed to. This might give the policy
handlers enough information to distinguish between the
"template views content" and "template is content itself" cases.

> ...
>The test of a policy is make with parent of object not this object. If
>i have a FSImage, the test is make with this context parent and no
>http cache is set.

This, meanwhile (CMF 1.5 and up) should have been fixed.



-- 
Dieter


More information about the Zope-CMF mailing list