Package twisted :: Package flow :: Module stage :: Class Callback
[show private | hide private]
[frames | no frames]

Class Callback

Instruction --+    
              |    
          Stage --+
                  |
                 Callback

Known Subclasses:
_Protocol

Converts a single-thread push interface into a pull interface.

Once this stage is constructed, its result, errback, and 
finish member variables may be called by a producer.   The
results of which can be obtained by yielding the Callback and
then calling next().   For example:

    source = flow.Callback()
    reactor.callLater(0, lambda: source.result("one"))
    reactor.callLater(.5, lambda: source.result("two"))
    reactor.callLater(1, lambda: source.finish())
    printFlow(source)

Method Summary
  __init__(self, *trap)
  __call__(self, result)
called by the producer to indicate a successful result
  __iter__(self)
(inherited from Stage)
  errback(self, fail)
called by the producer in case of Failure
  finish(self)
called by producer to indicate successful stream completion
  next(self)
return current result (inherited from Stage)
  result(self, result)
called by the producer to indicate a successful result
  _yield(self)
executed during a yield statement by previous stage

Class Variable Summary
class Instruction

Method Details

__call__(self, result)
(Call operator)

called by the producer to indicate a successful result

errback(self, fail)

called by the producer in case of Failure

finish(self)

called by producer to indicate successful stream completion

result(self, result)

called by the producer to indicate a successful result

_yield(self)

executed during a yield statement by previous stage

This method is private within the scope of the flow module, it is used by one stage in the flow to ask a subsequent stage to produce its value. The result of the yield is then stored in self.result and is an instance of Failure if a problem occurred.
Overrides:
twisted.flow.base.Stage._yield (inherited documentation)

Class Variable Details

Instruction

Instruction = twisted.flow.stage.Instruction

Generated by Epydoc 1.1 on Fri Jun 27 03:47:50 2003 http://epydoc.sf.net