On Aug 26, 6:27 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>
> I have to disagree on several points here. The first and most important: the
> OP does *not* want to pull data. He very clearly states that he wants to
> manipulate model objects in the template. The part you quoted above contains
> the word "change", which makes that rather obvious I'd say.

You're quite right, and I was wrong. I misread that part.

> And once the model is modified - how do the views reflect the changes that
> occured? Either they waste their time polling the model, or some event based
> triggering has to be employed as well. This can come from the model itself,
> but can easily end in useless re-rendering. Instead, the controller should -
> at least - initiate a final "update"-event - as only the controller knows
> when a series of model changes are actually finished.

Yes, it's fine for the controller to notify a view that it needs to be
updated, with typical observer/listener semantics. I think it's less
good when the controller has to collect all the relevant data from the
model and pass it to the view. This makes it harder to vary the
controller and view independently, which is often helpful.

> And last but not least, in the world of "normal" gui-applications, you set up
> a view and bind it to a model. In the web, this isn't possible due to the
> stateless nature of HTTP. So it's not only controller code we need to run, we
> also need to run view-setup-code, on each request.

My only quibble is that the view-setup-code is typically in the
controller. I don't have a perfect solution for this in mind, however.
There's obviously little to stop me moving all that code into the
template itself, but that seems to be mixing presentation with logic.
It feels like there should be another layer in there, but I don't
suppose many people would want that.

> This is somewhat mitigated in TG2 through the template-context. While that
> still is a tight coupling, it at least doesn't affect the actual
> returned "changed model event", the dictionary containing changed model data.

Is there documentation on this? It sounds interesting. A very quick
search of the TG2 docs didn't yield anything.

--
Ben Sizer

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to