[Twisted-Python] Woven and deferreds in controllers.
Glyph Lefkowitz
glyph at twistedmatrix.com
Fri Oct 31 15:48:19 MST 2003
Federico Di Gregorio wrote:
> they would be very usefull in theory. they could be used to change the
> model after reloading a form. imagine a form with action="" that reload
> itself until all controller constraints are satisfied and then redirect
> to the next page. unfortunately controllers _don't_ update the model
> (bug?) does nevow use controllers the right way or does it provide an
> alternative to them?
Nevow is not MVC (model/view/controller) it is "DR" (data/renderer).
Data is analagous to the Model, but it doesn't have the whole observer
framework attached to it. One big advantage is that you can have normal
Python objects -- lists, dicts, etc -- as data without any intermediate
wrappers. It seems that most use-cases for observing model updates can
be satisfied somewhere else (except for LivePage, which we are still
working on). Renderer is analagous to the view, but far simpler; it
uses a functional, rather than object-oriented approach to the template,
which seems to work better for laying out pages.
Really, Twisted Web provides everything you need for the "controller"
aspects of your code. Override 'render' and handle request.args before
drawing your "view" (woven or not) and you can do any HTTP-level logic
before even getting into page templating considerations.
More information about the Twisted-Python
mailing list