Re: [Zope-CMF] caching policy manager

2006-09-13 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 13 Sep 2006, at 01:30, Dmitry S. Makovey wrote:

whenever I request '/file_view' method on file objects - everything
works as expected, as soon as I use '/download' all the settings are
discarded by CPM.


Well, the settings are not discarded. The Cache Policy Manager just  
does not get a chance to apply them.


It is a long-standing bug that the CMFDefault File index_html (and  
download, which is obsolete in newer CMF versions) simply defers to  
index_html from OFS.File. That one doesn't know anything about Cache  
Policy Managers, it only deals with the Zope ZCacheable cache manager  
mechanism.


If you could, please file a bug report at http://www.zope.org/ 
Collectors/CMF/. All that needs to be done is to override index_html  
(which I believe was never done because the implementation in  
OFS.File is quite a beast - it was much easier to just reuse it).


jens

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

iD8DBQFFB7ADRAx5nvEhZLIRAp6vAJoDJy/ndoEh7Gu7EQCjIaO+e/ms4ACeIdJ6
HVDr49sNSs0qKgoIHDtKwM8=
=jESW
-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] Re: Tools as local utilities

2006-09-13 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 10 Sep 2006, at 20:09, Martin Aspeli wrote:
Just out of curiosity, which dependencies does Plone 3.0 have that  
require Zope 2.10? Or was it some papal edict to use 2.10?


2.10 really is lovely, because Zope 3.3 is lovely. :)

The local components story is much, much better. Look at Hanno's  
GSLocalAddOns package (which really should move to CMFCore once  
CMFCore is happy to require 2.10+), or other examples. Basically,  
it solves a lot of the problems we had with 2.9 and earlier in that  
it was hard to make things installable into a CMF site - a global  
utility or adapter was an either-or proposition for all sites in a  
Zope instance.


Being able to use local adapters (and local event handlers) is also  
very useful.


Plus, the whole story around formlib, zope.contentprovider,  
zope.viewlet is improved, (these three tools are great - if you  
haven't played with them, go read the doctests, or Rocky's formlib  
tutorial on plone.org) and Five has caught up to these to make them  
accessible to us.


Personally, I'm neutral on moving the requirement for CMF 2.1 to Zope  
2.10. Obviously we're not using any of those new features yet, but it  
would be nice to enable their use by mandating 2.10. CMF 2.2 will  
move the bar higher I'd wager.


I'd love to hear some kind of yay/nay for making Zope 2.10 the  
required platform for CMF 2.1 from some other people like Tres, Yvo,  
Florent etc.


jens


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

iD8DBQFFB7HdRAx5nvEhZLIRAqh0AJoDrhahQK1Q+vCqpxS0j8YICDLCoQCbBdlO
D5pbM5yW6tAzr5bmqNt7mco=
=aXQo
-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] caching policy manager

2006-09-13 Thread Stefan H. Holek
You don't want to cache views for Files and Images. I use this for  
predicate:


python: not view and object.portal_type=='File'

Stefan


On 13. Sep 2006, at 01:30, Dmitry S. Makovey wrote:



Playing with CPM I've discovered that if I put a policy like:

id: Files
Predicate: python:content.portal_type == File
Mod. time: content/modified
Max age: 1

with all noXXX checked, I have weird behaviour:

whenever I request '/file_view' method on file objects - everything
works as expected, as soon as I use '/download' all the settings are
discarded by CPM.



--
It doesn't necessarily do it in chronological order,
though.  --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] caching policy manager

2006-09-13 Thread Jens Vagelpohl

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


On 13 Sep 2006, at 10:04, Stefan H. Holek wrote:

You don't want to cache views for Files and Images. I use this for  
predicate:


python: not view and object.portal_type=='File'


I don't think this will help anything. The CPM never even fires,  
unfortunately.


jens


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

iD8DBQFFB8BORAx5nvEhZLIRAv25AKCuxY0dGNPMUK4jPBRfnCZz/2hwRQCeK47D
UpSfIpJuHEpfzF9YJwYLf2g=
=JWy1
-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] caching policy manager

2006-09-13 Thread Sidnei da Silva
On Wed, Sep 13, 2006 at 09:15:14AM +0200, Jens Vagelpohl wrote:
| It is a long-standing bug that the CMFDefault File index_html (and  
| download, which is obsolete in newer CMF versions) simply defers to  
| index_html from OFS.File. That one doesn't know anything about Cache  
| Policy Managers, it only deals with the Zope ZCacheable cache manager  
| mechanism.
| 
| If you could, please file a bug report at http://www.zope.org/ 
| Collectors/CMF/. All that needs to be done is to override index_html  
| (which I believe was never done because the implementation in  
| OFS.File is quite a beast - it was much easier to just reuse it).

As a workaround you can install the PolicyHTTPCacheManager product and
associate your file objects with it. 

  The PolicyHTTPCacheManager provides the ZCacheable mechanism, but
  when invoked defers to the Caching Policy Manager.

-- 
Sidnei da Silva
Enfold Systemshttp://enfoldsystems.com
Fax +1 832 201 8856 Office +1 713 942 2377 Ext 214
___
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] caching policy manager

2006-09-13 Thread Dieter Maurer
Jens Vagelpohl wrote at 2006-9-13 09:15 +0200:
 ...
It is a long-standing bug that the CMFDefault File index_html (and  
download, which is obsolete in newer CMF versions) simply defers to  
index_html from OFS.File. That one doesn't know anything about Cache  
Policy Managers, it only deals with the Zope ZCacheable cache manager  
mechanism.

I have defined CMF-aware ZODB object types. The one for File looks
like this:

# DM 2005-11-02: added
 CMF 'File' variant (CMF Cache Policy Manager aware)

from OFS.Image import File, manage_addFileForm, cookId

from utils import _setCacheHeaders, _ViewEmulator

class CMFFile(File):
'''CMF cache policy manager aware file.'''
meta_type = 'CPM aware File'

def index_html(self, REQUEST, RESPONSE):
' '
r = File.index_html(self, REQUEST, RESPONSE)
if self.ZCacheable_getManager() is None:
# not none cache manager already taken care of
_setCacheHeaders(self._getCPMCachingWrapper(), extra_context={})
return r

# DM 2006-05-17: more modular CPM caching
def _getCPMCachingWrapper(self):
return _ViewEmulator().__of__(self)
  

# essentially a copy of OFS.Image.manage_addFile -- we should probably
# use ReuseUtils.
def manage_addFile(self,id,file='',title='',precondition='', content_type='',
   REQUEST=None):
Add a new File object.

Creates a new File object 'id' with the contents of 'file'

id=str(id)
title=str(title)
content_type=str(content_type)
precondition=str(precondition)

id, title = cookId(id, title, file)

self=self.this()

# First, we create the file without data:
self._setObject(id, CMFFile(id,title,'',content_type, precondition))

# Now we upload the data.  By doing this in two steps, we
# can use a database trick to make the upload more efficient.
if file:
self._getOb(id).manage_upload(file)
if content_type:
self._getOb(id).content_type=content_type

if REQUEST is not None:
REQUEST['RESPONSE'].redirect(self.absolute_url()+'/manage_main')


def initialize(context):
context.registerClass(
CMFFile,
permission='Add Documents, Images, and Files',
constructors=(manage_addFileForm,
  manage_addFile),
)



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