[Zope3-Users] Re: viewtemplate

Jürgen Kartnaller juergen at kartnaller.at
Sun Oct 29 03:21:03 EST 2006


Hi Jakub.

eXt wrote:
> Hi all
> 
>   I recently read Stephan Richter's blog post: 
> http://blogs.lovelysystems.com/srichter/2006/09/20/the-skin-browser-and-lovely-systems-new-development-workflow 
> and "intendent scope of viewlets" thread: 
> http://thread.gmane.org/gmane.comp.web.zope.zope3.user/4652/focus=4652.
> 
> I like the idea behind viewtemplate very much (separation of template and view 
> code), but I've some problems with putting all of this together. Let me 
> summarize:
> 
> 1. Views and Viewlets belong to the layer
> 
> 2. Templates belong to the skin
> 
> 3. ViewletManagers belong to.. ? 
> 
> 4. Lovely's packaging practices says that: 
>     - views should be placed and registered in 
> project.browser.layer.<subpackage_for_the_view_impelentations> 
>     - templates should be placed and registered in project.browser.skin 
> package
>     - viewletmanagers... ? 

Where you place and register your code and templates is up to you.

Right now we do this :

Layer : view, viewlet and viewletManager code
         simple template which are not skin dependent
Skin : templates registered for the views and viewlets

I also use the macro feature from the <template> tag heavily.

If you don't plan to reuse your code in different skins registering 
everything on the layer or skin will work too.

It is also possible to first register everything on the layer. Then you 
will have a running application. If you need to provide another skin you 
just register the parts to replace on the new skin.

> 
> ViewletManagers may have a class and a template, VMs are called from 
> templates, viewlets are registered for VMs. Shouldn't it be resolved by 
> <template> tag which registers a template with ViewletManager as it is done 
> for Viewlets and Views?

Of course you can use all the features for ViewletManagers especially 
the RegisteredPageTemplate is perfect for ViewletManagers too.
A ViewletManager is just a special case of a ContentProvider (have a 
look at the interfaces).

> 
> One more thing is a layer declaration such as (from Stephan's post):
> 
> <browser:viewlet
>     name="bloglist"
>     for="myproject.interfaces.IBlog"
>     manager="myproject.browser.interfaces.IContent"
>     view="myproject.browser.blog.BlogPage"
>     class="myproject.browser.blog.BlogList"
>     layer="myproject.browser.IProjectLayer"
>     permission="zope.Public"
>     />
> 
> while template is registered for skin:
> <browser:template
>     template="bloglist.pt"
>     layer="myproject.browser.skin.IProjectSkin"
>     for="myproject.browser.blog.BlogList"
>     />
> 
> I'm pretty new to the skinnig concept. What is the purpose of IProjectLayer? 
> Is it that views and viewlets are registered to IProjectLayer which 
> is "project marker" interface, while templates are registered for skins. As a 
> result we have stable project's code base and skins which are just templates.

Yep

> 
> Any discussion on the above topics will be appreciated :)
> 
> 



More information about the Zope3-users mailing list