[Twisted-Python] Woven and deferreds in controllers.
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.
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/
Christopher Armstrong
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 :)
Ok, that is cool. Do I have to use Python 2.3 to use the latest Twisted?
Syver Enstad
Christopher Armstrong
writes: 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 :)
Ok, that is cool. Do I have to use Python 2.3 to use the latest Twisted?
By the way I found that the handling of deferreds from Controller.handle in View was totally broken in Twisted 1.0.6. Does anybody know if this is fixed in 1.1?
On 31 Oct 2003 11:47:27 +0100
Syver Enstad
By the way I found that the handling of deferreds from Controller.handle in View was totally broken in Twisted 1.0.6. Does anybody know if this is fixed in 1.1?
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
Il ven, 2003-10-31 alle 16:36, Itamar Shtull-Trauring ha scritto:
On 31 Oct 2003 11:47:27 +0100 Syver Enstad
wrote: By the way I found that the handling of deferreds from Controller.handle in View was totally broken in Twisted 1.0.6. Does anybody know if this is fixed in 1.1?
Personally I would just avoid using controllers, they're not good for much as far as I can tell.
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
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.
On Fri, Oct 31, 2003 at 10:17:06AM +0100, Syver Enstad wrote:
Christopher Armstrong
writes: 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 :)
Ok, that is cool. Do I have to use Python 2.3 to use the latest Twisted?
The README has the answer: "Twisted works with all Python 2.2 and 2.3 versions." (Although I can't see anywhere on the website that says this) -Andrew.
participants (6)
-
Andrew Bennetts
-
Christopher Armstrong
-
Federico Di Gregorio
-
Glyph Lefkowitz
-
Itamar Shtull-Trauring
-
Syver Enstad