I'm glad this topic finally came up, I always thought that View was
some what abstract in TG, where Model and Controller are well defined.
It seems that a your View is the data that the Controller returns
applied to a template (of whatever template plugin you use: Kid,
Cheetah, etc). Personally, I've been toying with a views.py, which
would contain some classes that define specific view logic.

Currently what I have is a set of widgets, which define their templates
as a string, and a single container called View. The View container
defines three lists: left, center, right, which are there to represent
the sections of my current  three column layout. These widgets are then
rendered in the master.kid template, and all my @expose methods just
specify proj.templates.default as the template, which does little more
than extend master.kid. Also, the master.kid still inserts the content
of the body of the child template, this is just prepended to the
'center' column.

Essentially what I've done is get rid of the need for returning a
dict(). The contollers methods all return an empty dict() just so that
expose applies the template. Instead all the pieces that make up the
view can be inserted into the View class, this also allows things to be
added before and after the controller itself is run.

One example of the usefulness of this, is with static/global menues, I
have  the left side, and some links in a bar across the top defined in
the database, and the __init__ of View loads them automatically.

Sean


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to