[Nitro] Views and Templating

Peter Abrahamsen rainhead at gmail.com
Tue Sep 6 19:04:58 EDT 2005


The V part of MVC feels neglected. Actions and views seem to be the  
same thing in Nitro, and that's (for my uses) a weakness. I still  
don't know Nitro well enough to know what breaking out of that  
circumstance entails. Here are some problems that arise:

- I'd like to ask for some model object ("entity"?) to express itself  
in some way, I have to do some work to track down the right view. I'd  
like to just say, "Tell the person whose name is Fred to give me a  
summary of himself." But as things are, a Person has no idea how to  
do that. This becomes a problem if the view is associated with a  
different Controller.

- If I want a site-wide (across Controllers) generic page template,  
then each action_view template needs to call something in the  
Controller, or something in the Skin (some Element). A view shouldn't  
be /expected/ to provide or delegate to provide an <html> tag. What  
I'd like is for the template to have that option, or else the  
Controller can provide wrap the template, and the Controller may  
additionally resort to a site-wide template (which would happen by  
default if nothing's specified in the Controller). I'm not positive  
about this division of responsibility, but it's closer to what I'd  
like to see.
--> does Advice have something to do with this?

All of this is informed by Zope's Page Templates (ZPT, TAL, and  
TALES) which provided a large degree of flexibility. It was almost  
Aspect-oriented, in that templates could replace parts of each other,  
and data could be coming from several different parts of the code. If  
you haven't seen ZPT in action, it's entirely worthwhile to install a  
copy of Plone or something and see how it works. Having actions and  
views coupled tightly precludes this kind of behavior.

I'd enjoy hearing how I'm not seeing things correctly, or how to  
achieve some of these goals in Nitro without going crazy.

Cheers, Peter



More information about the Nitro-general mailing list