[Zope-CMF] CachingPolicy

2006-06-22 Thread LESUEUR Frédéric

hello,
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 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.

In my opinion content must be set to context obj, like that:
content=obj

Maybe this product is not use anymore and http cache manager is use instead.

thanks in advance
fred
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] CachingPolicy

2006-06-22 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 22 Jun 2006, at 15:08, LESUEUR Frédéric wrote:


hello,
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 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.

In my opinion content must be set to context obj, like that:
content=obj


Please look at how it is being invoked inside e.g. CMFCore/FSFile.py  
or CMFCore/FSImage.py. What gets passed into _setCacheHeaders is  
*not* the Image or File, but a so-called view emulator. Its parent is  
indeed the Image or File itself, so the function works correctly.


jens

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.1 (Darwin)

iD8DBQFEmtE9RAx5nvEhZLIRAqHEAJ9gTAVjqpduu8RN2pCdJCMqIjGRKgCfaZs1
lIBg6YEX7iOKe4B1mRBPtY4=
=+19p
-END PGP SIGNATURE-
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] CachingPolicy

2006-06-22 Thread Dieter Maurer
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
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] CachingPolicy

2006-06-23 Thread Frédéric LESUEUR
Le Jeudi 22 Juin 2006 20:00, vous avez écrit :
> LESUEUR Frédéric wrote at 2006-6-22 15:08 +0200:

> This, meanwhile (CMF 1.5 and up) should have been fixed.
ok thanks, this is what i'm thinking, it fail with object that are call 
without view (like stylesheet or FSImage ...). Maybe it's ok with newer 
version of CMF (>=1.5), i can't test at this time.
It's a CMF (1.4.7) inside a version 3.2.3 of CPS.
bye

___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests


Re: [Zope-CMF] CachingPolicy

2006-06-23 Thread Dieter Maurer
Frédéric LESUEUR wrote at 2006-6-23 10:03 +0200:
>Le Jeudi 22 Juin 2006 20:00, vous avez écrit :
>> LESUEUR Frédéric wrote at 2006-6-22 15:08 +0200:
>
>> This, meanwhile (CMF 1.5 and up) should have been fixed.
>ok thanks, this is what i'm thinking, it fail with object that are call 
>without view (like stylesheet or FSImage ...). Maybe it's ok with newer 
>version of CMF (>=1.5), i can't test at this time.
>It's a CMF (1.4.7) inside a version 3.2.3 of CPS.

If you care, you can backport the change to your older CMF version...

Of course, upgrading might be a better option...



-- 
Dieter
___
Zope-CMF maillist  -  Zope-CMF@lists.zope.org
http://mail.zope.org/mailman/listinfo/zope-cmf

See http://collector.zope.org/CMF for bug reports and feature requests