A Twisted Design Decision
koranthala at gmail.com
Wed Jan 28 15:30:32 CET 2009
On Jan 28, 7:10 pm, Jean-Paul Calderone <exar... at divmod.com> wrote:
> On Wed, 28 Jan 2009 02:02:57 -0800 (PST), koranthala <koranth... at gmail.com> wrote:
> >On Jan 27, 9:27 pm, koranthala <koranth... at gmail.com> wrote:
> >> On Jan 27, 6:57 pm, Jean-Paul Calderone <exar... at divmod.com> wrote:
> > [snip]
> >> Thank you Jean-Paul.
> >> My code is more complex than what I have mentioned. When I mentioned
> >> msg.send, the msg object actually gets the data from DB etc to send.
> >> And there are many other items being done.
> >> I will try to see whether I can change the code to incorporate what
> >> you mentioned.
> >> I rewrote most of my code after learning just raw deferreds - I had
> >> planned to study inlineCallbacks - but then it slipped my mind - now
> >> it has come to bit me. :-(
> > I tried to update the code as per the suggestion, but to no avail.
> > My system uses Python2.4.3 (cannot move to 2.5) - so I tried to
> >rewrite with deferredGenerators - since I thought inlineCallbacks are
> >similar to deferredGenerators.
> > But I cannot seem to rewrite it in a format where the functional
> >encapsulation is not broken.
> > i.e. as I mentioned in the first example - I have to pass SELF to
> >child objects for them to modify it.
> Why? You don't do this in the original version of your code. Why do
> it after switching to Twisted (particularly since you seem to want *not*
Without that, I am unable to increment success and failure counters
which are part of the message handler object.
In the original version, if send fails the return value of
protocol.send is propogated back to msg.send and to msg handler.send.
But in twisted, it is not so. So, I have to pass in SELF through to
increment success and failure counter.
Is it possible otherwise in twisted?
More information about the Python-list