[Zope] Re: __before_publishing_traverse__ and caching

Tobias Herp therp at apriori.de
Thu Oct 23 04:52:06 EDT 2003


Dieter Maurer wrote:

> Tobias Herp wrote at 2003-10-22 15:43 +0200:
>  > I have a Python product which features a __before_publishing_traverse__ 
>  > method, setting some REQUEST variables and in turn deleting the optional 
>  > "([language],[template])" path element. Now I'd like to get the Cache 
>  > Manager to cache these http://the.domain/path/to/site/(en,default)/home 
>  > etc. pages (and, of course, appropriate versions of 
>  > http://the.domain/path/to/site/(en,default)/site.css etc as well).
>  > 
>  > However, when I create a RAM Cache Manager in the site object, this 
>  > won't use these virtual paths (with "(en,default)" just behind the site 
>  > object) but the physical ones.  Is it possible to tell the Cache Manager 
>  > to cache just every request to a page object, preserving the given path?
> 
> The objects are themselve responsible for caching.
> Thus, your objects should be able to override the "ZCachable"
> methods to do what you want.

My objects inherit Cacheable, and when I go to the 'Associate' tab of 
the RAM Cache Manager and 'Locate' 'all' objects of my page type, they 
are listed.  I can even associate them.  But even when I do a full 
reload of a associated page, it isn't added to the cache.

Isn't it sufficient to inherit Cacheable, and the result of the 
index_html method will be cached?  What more is needed?

Furthermore, for each of my pages there is possibly more than one 
version: when my site supported english and german contents, and 
provided the page templates 'default' and 'mozilla', their URLs would 
optionally contain '(en,default)', '(de,default)', '(en,mozilla)' or 
'(de,mozilla)' as the first path segment behind the site.  These URLs 
won't ever be listed in the association tab, right?  So how can I get 
them cached? Can't my objects be recognised as cacheable just by their 
type, and automatically added when first accessed?

Thanks,

Tobias





More information about the Zope mailing list