[z3-five] Re: pagetemplate resources

Philipp von Weitershausen philipp at weitershausen.de
Mon Apr 25 22:17:30 CEST 2005


Jan-Wijbrand Kolman wrote:
> Hello,
> 
> 
> I just now checked in a test and a fix for a bug where publishing a
> PageTemplateResource would fail.
> 
> I am not 100% the current fix actually has the behaviour we want.

In short: Well done, I think this is the right fix.

> So I have a couple of questions:
> 
> Shouldn't PageTemplateResources behave like 'normal' resources as much as
> possible? So, the __call__ method returns the resource's absolute URL and the
> __browser_default__ method returns the name to call on the resource when being
> published?
> 
> And, more or less related, wouldn't it make sense to follow the pattern in
> FileResource, where the HTTP method is used for the name to call on the resource
> instance? Would it then not also make sense to send out HTTP cache headers etc.
> for all types of resources, like is done for FileResource resources?
> 
> I'm not sure - for one because I didn't yet study Zope-3's implementation for
> resources in complete detail. And I guess we want to follow Zope-3's behaviour?
> Or maybe Zope-3's resources are not optimal yet either?

The class you fixed in Five is not the resource itself, it's the view 
that publishes the resource (the naming is a bit confusing). The actual 
resource implementation is imported from Zope 3, only the view had to be 
rewritten. So, the view behaviour is what we need to look at, and I 
think you hit the nail on the head with it.

One would have to test whether the same problem arises in Zope 3 as 
well. It might be indeed that PageTemplate resources are borked in Zope 
3, too, but one would have to find out and submit a collector issue... 
*wink* :).

Good job, I'll integrate this into my restructuring branch so it won't 
get lost.

Philipp


More information about the z3-five mailing list