[Zope-CMF] Re: problem creating Five views for CMF

Jens Vagelpohl jens at dataflake.org
Thu Oct 13 18:24:14 EDT 2005


On 13 Oct 2005, at 11:39, pete wrote:
> bah!  Next attempt - I copied an example from Five to get started  
> and it Just Worked, so you must be close!
>
> Should it not be <browser:pages> rather than <browser:view>?
>
> And I'm not sure it should have a name="link_view" in the  
> containing definition as that would apply to all the contained page  
> definitions (which could be confusing)  - perhaps in  
> <browser:defaultView> instead?

Thanks to Pete and Lennart it works now - Lennart for suggesting the  
usage of browser:page instead of browser:view and for Pete to mention  
browser:pages, which let me easily "shadow" several "names" with  
little zcml code, namely "link_view", "index_html", "index.html" and  
"view". Those are the names and aliases currently provided by the  
Link type in the TypesTool.

A very unscientific test using "ab" to hammer both the "old-style"  
CMF view and the view class as given to me by Tres suggest that the  
view class approach *doubles* the serving speed. The template I am  
using is the same link_view.pt currently on the trunk with the part...

<p i18n:translate="">Link: <a href=""
               tal:attributes="href here/remote_url"
               tal:content="here/remote_url"
               i18n:name="link"
            >http://www.zope.org</a></p>

replaced by a call to the view class, which looks like this:

<div tal:replace="structure view/renderContent"/>

The view class "renderContent" method emits the same HTML as produced  
by the p tag from the current template, minus i18n processing.

I'll work on converting more content types along the same lines over  
the next few days on a svn branch.

jens



More information about the Zope-CMF mailing list