Thomas P Jakobsen <[email protected]> writes: > # HG changeset patch > # User Thomas P Jakobsen <[email protected]> > # Date 1244721950 -7200 > # Node ID e1270881794e39f81445820c4133fad317af6e0f > # Parent 8ec45943c12ab91430d03a8895aabc6f64fe7a37 > Clone errors.
Please don't make a big and interesting [0 of 1] mail with all the good stuff and then leave out the explaination in the commit message. > diff -r 8ec45943c12a -r e1270881794e viff/util.py > --- a/viff/util.py Wed May 27 22:29:31 2009 +0200 > +++ b/viff/util.py Thu Jun 11 14:05:50 2009 +0200 > @@ -185,12 +185,16 @@ > print fmt % tuple(args) > > > -def clone_deferred(original): > +def clone_deferred(original, splitErr=True): It should be called split_err to follow the normal code style. > """Clone a Deferred. > > The returned clone will fire with the same result as the original > :class:`Deferred`, but will otherwise be independent. > > + If *splitErr* is true errors will propagate to both the original > + and the cloned deferred. If *splitErr* is false errors only > + propagate into the cloned deferred. > + > It is an error to call :meth:`callback` on the clone as it will > result in an :exc:`AlreadyCalledError` when the original > :class:`Deferred` is triggered. > @@ -212,8 +216,12 @@ > def split_result(result): > clone.callback(result) > return result > + def split_err(error): > + if splitErr: > + clone.errback(error) > + return result what is 'result' here? > clone = Deferred() > - original.addCallback(split_result) > + original.addCallbacks(split_result, split_err) > return clone Should this also be done for the clone method in Share? Or maybe one of the two could be deleted? -- Martin Geisler VIFF (Virtual Ideal Functionality Framework) brings easy and efficient SMPC (Secure Multiparty Computation) to Python. See: http://viff.dk/. _______________________________________________ viff-patches mailing list [email protected] http://lists.viff.dk/listinfo.cgi/viff-patches-viff.dk
