Re: [Zope-CMF] CachingPolicyManager

2006-10-13 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 13 Oct 2006, at 14:06, [EMAIL PROTECTED] wrote:
Thus, this *is* the bug. It should distinguish between primary and  
nested

rendering.

Unfortunately, the bug is probably deep -- affecting the complete
cache integration. Even more importantly, for a RAM cache it may
even be a good thing that the "nested" rendering can cache in addition
to the "primary" rendering.


Absolutely, RAM caches and similar caching mechanisms should still  
get a chance to do their work for both the requested item as well as  
sub-items that get called from the requested template.


Tres just had a good idea and I'll play around to see if this works:  
Before calling the CPM, see if REQUEST['PUBLISHED'] is the currently  
rendering item (in that case we want CPM), or if it is not, meaning  
we hit a sub-template and don't want CPM.


jens


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

iD8DBQFFL+72RAx5nvEhZLIRAiA/AJwIoy/nz0umpfY3B+NfRwEsMoTymwCghHRz
jUbkw0Rx0eA1DaCOGoFc5LY=
=GhT2
-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] CachingPolicyManager

2006-10-13 Thread Dieter . Maurer
Jens Vagelpohl wrote at 2006-10-11 12:03 -0400:
> ...
>I'm not sure this can be called a bug. It is true (and perfectly  
>normal) that rendering a filesystem page template will always call  
>the CPM. You're rendering both here. Since output_page_2 is rendered  
>last as it's calles from output_page_1 the rule for output_page_2  
>fires and will overwrite existing headers/add new headers according  
>to the rule that fires. The problem here is that both happen in the  
>same request, the rendering code does not distinguish betwen the  
>primary and the nested rendering.

Thus, this *is* the bug. It should distinguish between primary and nested
rendering.

Unfortunately, the bug is probably deep -- affecting the complete
cache integration. Even more importantly, for a RAM cache it may
even be a good thing that the "nested" rendering can cache in addition
to the "primary" rendering.



-- 
Viele Grüße
Dieter

Tel: 06894-870 177
___
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] CachingPolicyManager

2006-10-11 Thread Dieter Maurer
Miles Waller wrote at 2006-10-11 16:34 +0100:
> ...
>output_page_2:
>==
>Here is the subtitle from template 2
>
>2.  Add a rule to the cpm as follows:
>
>id: "template_test"
>predicate: view.endswith('_2')
>etag: string:"template_test"
>
>3.  Make a request for /output_page_1
>
>4.  Note that the caching rule for output_page_2 is applied
>
>This is because the cpm is called whenever a FSZPT is called - so the 
>call to the second template causes it to check it's rules again.
>
>My question is, does this count as a bug?

I would say "yes"...

Please file a bug report to the CMF collector.



-- 
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] CachingPolicyManager

2006-10-11 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


1. Add two filesystem zpts:

output_page_1:
==


 test page


Here is the title






output_page_2:
==
Here is the subtitle from template 2

2.  Add a rule to the cpm as follows:

id: "template_test"
predicate: view.endswith('_2')
etag: string:"template_test"

3.  Make a request for /output_page_1

4.  Note that the caching rule for output_page_2 is applied

This is because the cpm is called whenever a FSZPT is called - so  
the call to the second template causes it to check it's rules again.


My question is, does this count as a bug?


I'm not sure this can be called a bug. It is true (and perfectly  
normal) that rendering a filesystem page template will always call  
the CPM. You're rendering both here. Since output_page_2 is rendered  
last as it's calles from output_page_1 the rule for output_page_2  
fires and will overwrite existing headers/add new headers according  
to the rule that fires. The problem here is that both happen in the  
same request, the rendering code does not distinguish betwen the  
primary and the nested rendering.


jens


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

iD8DBQFFLRXRRAx5nvEhZLIRAotWAKCXhqMMsbWiBDGmiyzkAh82WfmPKACfQTg0
x7Bvb1S/eObv48e3Rdc7LYw=
=Deln
-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


[Zope-CMF] CachingPolicyManager

2006-10-11 Thread Miles Waller

Hi,

I'm trying to investigate a problem where the CPM is adding cache 
headers to a response for the wrong object.  I can reproduce it in plain

CMF as follows:


1. Add two filesystem zpts:

output_page_1:
==


 test page


Here is the title






output_page_2:
==
Here is the subtitle from template 2

2.  Add a rule to the cpm as follows:

id: "template_test"
predicate: view.endswith('_2')
etag: string:"template_test"

3.  Make a request for /output_page_1

4.  Note that the caching rule for output_page_2 is applied

This is because the cpm is called whenever a FSZPT is called - so the 
call to the second template causes it to check it's rules again.


My question is, does this count as a bug?

I know that this example can be made to work by reformulating so that 
output_page_1 is a macro and requesting output_page_2, but if that's the 
answer then I think it should definitely be clearer in the docs.



Miles

___
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: RES: [Zope-CMF] CachingPolicyManager and Image/File content

2006-04-05 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 5 Apr 2006, at 21:44, Sidnei da Silva wrote:


The PolicyHTTPCacheManager is ZPL. I'm willing to donate it's code.
-- Sidnei da Silva Enfold Systems, Inc. http://www.enfoldsystems.com


Thanks Sidnei, this is much appreciated. I'm going to update the  
existing CMF collector issue accordingly and assign it to myself. As  
I said, this won't make it into CMF 2.0 but 2.1, which means you can  
count on it for Plone 3.0.


jens


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

iD8DBQFENC3dRAx5nvEhZLIRAl34AJ4y8rgvbFywvkLUHaqAp+IiNfO0XgCffOsL
z0MWXsmP2bXoIsDubDgNtsk=
=m/dW
-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


RES: [Zope-CMF] CachingPolicyManager and Image/File content

2006-04-05 Thread Sidnei da Silva
Title: Re: [Zope-CMF] CachingPolicyManager and Image/File content






The PolicyHTTPCacheManager 
is ZPL. I'm willing to donate it's code.
-- 
Sidnei da Silva
Enfold Systems, Inc.
http://www.enfoldsystems.com



De: [EMAIL PROTECTED] em nome de 
Jens VagelpohlEnviada: qua 5/4/2006 17:40Para: 
zope-cmf@lists.zope.orgAssunto: Re: [Zope-CMF] CachingPolicyManager 
and Image/File content

-BEGIN PGP SIGNED MESSAGE-Hash: SHA1The 
combining of Zope's HTTPCacheManager and the CMF CachingPolicyManager 
is yet another item which really should not be in some standalone 
thingy but integrated into the CachingPolicyManager itself...  I 
hope to do this in time for CMF 2.1.jensOn 5 Apr 2006, at 
21:06, Stefan H. Holek wrote:> I have it working fine using the 
PolicyHTTPCacheManager from CacheFu.> http://dev.plone.org/collective/browser/CacheFu/trunk/> 
PolicyHTTPCacheManager>> Stefan>> On 5. Apr 2006, at 
15:19, Bert Vanderbauwhede wrote:>>> 
Hi,>>>> I'm currently setting up a CMF site for testing 
purposes. While >> configuring the>> 
CachingPolicyManager, I discovered that it didn't work for the >> 
Image and File>> content types. However, it worked perfectly for the 
Document content>> type. I only>> got it working for Image 
and File after I modified the index_html>> () method in>> 
CMFDefault/Image.py and CMFDefault/File.py. Anyone knows what 
I'm >> doing>> wrong? Or is this a known 
problem?>>>> I'm using CMF 1.4.7. Is this problem perhaps 
solved in a later >> version?>>>> 
--> Anything that happens, happens.  --Douglas 
Adams>>> 
___> 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-BEGIN PGP 
SIGNATURE-Version: GnuPG v1.4.1 
(Darwin)iD8DBQFENCs9RAx5nvEhZLIRAtf0AKCYG8xSa4oZ52MXGYDJuaDPKFDYtwCgumIZ7yM1Js9vAPGirq299TLHrrg==XXfO-END 
PGP 
SIGNATURE-___Zope-CMF 
maillist  -  Zope-CMF@lists.zope.orghttp://mail.zope.org/mailman/listinfo/zope-cmfSee 
http://collector.zope.org/CMF for 
bug reports and feature requests


___
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] CachingPolicyManager and Image/File content

2006-04-05 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

The combining of Zope's HTTPCacheManager and the CMF  
CachingPolicyManager is yet another item which really should not be  
in some standalone thingy but integrated into the  
CachingPolicyManager itself...  I hope to do this in time for CMF 2.1.


jens


On 5 Apr 2006, at 21:06, Stefan H. Holek wrote:


I have it working fine using the PolicyHTTPCacheManager from CacheFu.
http://dev.plone.org/collective/browser/CacheFu/trunk/ 
PolicyHTTPCacheManager


Stefan

On 5. Apr 2006, at 15:19, Bert Vanderbauwhede wrote:


Hi,

I'm currently setting up a CMF site for testing purposes. While  
configuring the
CachingPolicyManager, I discovered that it didn't work for the  
Image and File

content types. However, it worked perfectly for the Document content
type. I only
got it working for Image and File after I modified the index_html 
() method in
CMFDefault/Image.py and CMFDefault/File.py. Anyone knows what I'm  
doing

wrong? Or is this a known problem?

I'm using CMF 1.4.7. Is this problem perhaps solved in a later  
version?




--
Anything that happens, happens.  --Douglas Adams


___
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


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

iD8DBQFENCs9RAx5nvEhZLIRAtf0AKCYG8xSa4oZ52MXGYDJuaDPKFDYtwCgumIZ
7yM1Js9vAPGirq299TLHrrg=
=XXfO
-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] CachingPolicyManager and Image/File content

2006-04-05 Thread Stefan H. Holek

I have it working fine using the PolicyHTTPCacheManager from CacheFu.
http://dev.plone.org/collective/browser/CacheFu/trunk/ 
PolicyHTTPCacheManager


Stefan

On 5. Apr 2006, at 15:19, Bert Vanderbauwhede wrote:


Hi,

I'm currently setting up a CMF site for testing purposes. While  
configuring the
CachingPolicyManager, I discovered that it didn't work for the  
Image and File

content types. However, it worked perfectly for the Document content
type. I only
got it working for Image and File after I modified the index_html()  
method in
CMFDefault/Image.py and CMFDefault/File.py. Anyone knows what I'm  
doing

wrong? Or is this a known problem?

I'm using CMF 1.4.7. Is this problem perhaps solved in a later  
version?




--
Anything that happens, happens.  --Douglas Adams


___
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] CachingPolicyManager and Image/File content

2006-04-05 Thread Dieter Maurer
Bert Vanderbauwhede wrote at 2006-4-5 15:19 +0200:
> ...
>I'm currently setting up a CMF site for testing purposes. While configuring the
>CachingPolicyManager, I discovered that it didn't work for the Image and File
>content types. However, it worked perfectly for the Document content
>type. I only
>got it working for Image and File after I modified the index_html() method in
>CMFDefault/Image.py and CMFDefault/File.py. Anyone knows what I'm doing
>wrong? Or is this a known problem?

You may look how I made "FSFile" and "FSImage" CachingPolicyManager
aware. The change is now in CMFCore.


-- 
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] CachingPolicyManager and Image/File content

2006-04-05 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 5 Apr 2006, at 14:19, Bert Vanderbauwhede wrote:
I'm currently setting up a CMF site for testing purposes. While  
configuring the
CachingPolicyManager, I discovered that it didn't work for the  
Image and File

content types. However, it worked perfectly for the Document content
type. I only
got it working for Image and File after I modified the index_html()  
method in
CMFDefault/Image.py and CMFDefault/File.py. Anyone knows what I'm  
doing

wrong? Or is this a known problem?

I'm using CMF 1.4.7. Is this problem perhaps solved in a later  
version?


Can't speak for CMF 1.4, looking at 1.5+ here:

Later versions use the very same rendering code for CMFDefault/ 
Image.py and CMFDefault/File.py, there were no changes. Not sure if  
that's helpful to you, but putting them into a skins directory on the  
filesystem *will* trigger the CachingPolicyManager.


jens

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

iD8DBQFEM8reRAx5nvEhZLIRAiYHAJ9jp3RpwEHwNfBi2byS1F1mNWCHEQCgkThW
jxEYoV5oIoDa6V6p+bHHFIg=
=0fkO
-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


[Zope-CMF] CachingPolicyManager and Image/File content

2006-04-05 Thread Bert Vanderbauwhede
Hi,

I'm currently setting up a CMF site for testing purposes. While configuring the
CachingPolicyManager, I discovered that it didn't work for the Image and File
content types. However, it worked perfectly for the Document content
type. I only
got it working for Image and File after I modified the index_html() method in
CMFDefault/Image.py and CMFDefault/File.py. Anyone knows what I'm doing
wrong? Or is this a known problem?

I'm using CMF 1.4.7. Is this problem perhaps solved in a later version?

--
Batlock666...
  "I aim to misbehave."
___
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


[Zope-CMF] CachingPolicyManager improvements checked in to svn

2005-09-07 Thread Geoff Davis
I have checked my CachingPolicyManager improvements into the
geoffd-cachingpolicymanager-branch.  Enjoy!

Geoff

PS  Those of you who raised concerns about ZopeTestCase causing test
problems in Zope 2.7 might want to take a look at why test_z3interfaces is
broken when you run the tests with zopectl test.

___
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] CachingPolicyManager improvements

2005-09-02 Thread Jens Vagelpohl


I have written unit tests for all the new functionality including  
what I

believe to be the first CMFCore test suite to use ZopeTestCase.
ZopeTestCase provides a lot of useful functionality, including
functional tests, that I think will make for easier test writing going
forward.

Is there anything I need to do before checking it in?


Since this involves several pieces I would create a branch in  
Subversion and put it there for the moment so that everyone can take  
a good look.


IMHO there is at least one problematic item (well, it's not for the  
trunk, but for the 1.5/1.4 branches), which is the dependency on  
ZopeTestCase. The way the code works right now you immediately  
prevent any tests from running on platforms that do not have  
ZopeTestCase installed - it blows up the testrunner. That needs to  
degrade a bit more gracefully in the absence of ZopeTestCase.


On the other hand there are items I would consider fit for merging  
immediately, such as all the added header handling in the  
CachingPolicyManager. The 1.5 branch is currently under "lockdown"  
until Sunday when I will tag CMF 1.5.4 final.


jens

___
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] CachingPolicyManager improvements

2005-09-02 Thread Sidnei da Silva
On Fri, Sep 02, 2005 at 04:31:26PM -0400, Geoff Davis wrote:
| Hi all--
| 
| I have added some useful new functionality to CMFCore's
| CachingPolicyManager:

I am interested in all of this, and volunteer to backport it to CMF
1.4 if no-one objects me doing so.


-- 
Sidnei da Silva
Enfold Systems, LLC.
http://enfoldsystems.com
___
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


[Zope-CMF] CachingPolicyManager improvements

2005-09-02 Thread Geoff Davis
Hi all--

I have added some useful new functionality to CMFCore's
CachingPolicyManager:

1) Caching policies can now control all the Cache-Control tokens defined
in the HTTP 1.1 spec (s-maxage, public, private, no-transform).  To
implement this, I have added some extra keyword arguments to the API;
existing calls should not break, though.

2) When you enable no-cache, a Pragma: no-cache header is also sent for
HTTP 1.0 clients

3) FSPageTemplates have the option to return a status 304 + no content
when a conditional GET is sent.  This is a potential significant win for
sites. 

How it works: When a client has an expired page in its local cache, it
sends a conditional GET to the server.  Basically that means that there
will be an If-Modified-Since header with the timestamp of the local cached
page and, if the cached page was originally sent with an ETag, an
If-None-Match header with the ETag of the cached page (actually a list of
ETags of cached pages).

If an FSPageTemplate is associated with a Caching Policy and that Caching
Policy has 304s explicitly enabled, a series of checks take place.  If
there is an If-Modified-Since header, the server checks the modification
time associated with the template via the Caching Policy.  If there is an
If-None-Match header and the Caching Policy defines an ETag function, the
ETag is checked.  If all the checks pass, the server returns a 304 status
and stops without rendering the page.  The server does less computation,
and less data goes over the wire, so it's a double win.

I have written unit tests for all the new functionality including what I
believe to be the first CMFCore test suite to use ZopeTestCase. 
ZopeTestCase provides a lot of useful functionality, including
functional tests, that I think will make for easier test writing going
forward.

Is there anything I need to do before checking it in?

Geoff



___
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