[Twisted-Python] Woven and deferreds in controllers.
![](https://secure.gravatar.com/avatar/a22e04083491fbc191316f625058b8bc.jpg?s=120&d=mm&r=g)
I've heard on this list that it is possible to use deferreds in controllers. Let's say I have a page class that needs to load a deferred object before any of it's wmfactory_ methods make any sense. What I have done previously is to store the deferred and chain new deferreds on every wmfactory method and return them instead of a real value. If deferred in controlers work the way I hope I could load the actual domain object from the deferred and store it in my page class before any of the wmfactory methods are called which would be nice. So my question is how do I use a controller for this (if it is possible). Btw. I've yet to upgrade to 1.1 because the application is still using the old cred system.
![](https://secure.gravatar.com/avatar/3a7e70f3ef2ad1539da42afc85c8d09d.jpg?s=120&d=mm&r=g)
On Thu, Oct 30, 2003 at 09:20:11PM +0100, Syver Enstad wrote:
Btw. I've yet to upgrade to 1.1 because the application is still using the old cred system.
Old cred isn't gone! It's just deprecated. Please upgrade, you shouldn't have problems with backwards compatibility. If you do, please tell us :) Sorry for not answering your actual question, I can't. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://twistedmatrix.com/users/radix.twistd/
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On 31 Oct 2003 11:47:27 +0100 Syver Enstad <syver@inout.no> wrote:
Personally I would just avoid using controllers, they're not good for much as far as I can tell. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python & Twisted consulting
![](https://secure.gravatar.com/avatar/197ee70acd5db0b7033333a04acce778.jpg?s=120&d=mm&r=g)
Il ven, 2003-10-31 alle 16:36, Itamar Shtull-Trauring ha scritto:
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? -- Federico Di Gregorio Debian GNU/Linux Developer fog@debian.org INIT.D Developer fog@initd.org The reverse side also has a reverse side. -- Japanese proverb
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
Federico Di Gregorio wrote:
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.
![](https://secure.gravatar.com/avatar/3a7e70f3ef2ad1539da42afc85c8d09d.jpg?s=120&d=mm&r=g)
On Thu, Oct 30, 2003 at 09:20:11PM +0100, Syver Enstad wrote:
Btw. I've yet to upgrade to 1.1 because the application is still using the old cred system.
Old cred isn't gone! It's just deprecated. Please upgrade, you shouldn't have problems with backwards compatibility. If you do, please tell us :) Sorry for not answering your actual question, I can't. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://twistedmatrix.com/users/radix.twistd/
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On 31 Oct 2003 11:47:27 +0100 Syver Enstad <syver@inout.no> wrote:
Personally I would just avoid using controllers, they're not good for much as far as I can tell. -- Itamar Shtull-Trauring http://itamarst.org/ Available for Python & Twisted consulting
![](https://secure.gravatar.com/avatar/197ee70acd5db0b7033333a04acce778.jpg?s=120&d=mm&r=g)
Il ven, 2003-10-31 alle 16:36, Itamar Shtull-Trauring ha scritto:
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? -- Federico Di Gregorio Debian GNU/Linux Developer fog@debian.org INIT.D Developer fog@initd.org The reverse side also has a reverse side. -- Japanese proverb
![](https://secure.gravatar.com/avatar/e1554622707bedd9202884900430b838.jpg?s=120&d=mm&r=g)
Federico Di Gregorio wrote:
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.
participants (6)
-
Andrew Bennetts
-
Christopher Armstrong
-
Federico Di Gregorio
-
Glyph Lefkowitz
-
Itamar Shtull-Trauring
-
Syver Enstad