Gary Poster wrote:

> On Sep 16, 2005, at 5:20 PM, Garrett Smith wrote:
>> That's right. But the view can solve these problems easily without  a
>> lot of other stuff like yet-another-ZCML directive and  automagical
>> transformation of the HTML head element.
> ...
>> This is a trivial change to the existing Zope code.
> Agreed that if that is all you need, your solution is very reasonable 
> and less intrusive.  The story becomes more interesting if your main 
> view class has no idea if there is a widget (or something else that 
> needs some JS/CSS) on it.
> Maybe you don't have this use case, in which case you don't need to 
> worry about it.  Your solution works fine for the non-composed-page 
> (i.e., not portlets and not dynamically assembled a la CPSSkins) case.
> Gary


I agree, it feels more confortable to push the JS/CSS content into the
<head> markup than pulling it from inside a ZPT, or a script.

the idea is that adding content into the head must be easily done  at
any stage of a pipeline. I don't see how the ZPT solution that you are
describing Garett could work in cpsskins, since there is no obvious list
of widget inside a "flat" page view.

there is no such thing as:

    for widget in self.widgets()

since getting the list of widgets done is in a recursive tree traversal
process, with relation queries, adapter lookups, etc.

in terms of performance, it would mean that the page would have to be
rendered twice (once for the page's content and another time for the
head). This is what is done in the zope2 version of CPSSkins, and it is
not a very elegant solution.

Zope3-dev mailing list

Reply via email to