Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Private Attributes
MoinMoin.util.rpc_aggregator.RPCYielder Class Reference

List of all members.

Public Member Functions

def __init__
def fetch_call
def set_result
def fetch_result
def run

Public Attributes


Private Attributes


Detailed Description

If you want to have a batchable function, you need
to inherit from this class and define a method "run" that
takes exactly one argument.
This method has to be a generator that yields (func, arg)
tuples whereas func is the RPC method name (str).
You can fetch the calls by calling fetch_call(),
then you have to return the result by calling set_result(res).

Definition at line 15 of file

Constructor & Destructor Documentation

def MoinMoin.util.rpc_aggregator.RPCYielder.__init__ (   self,
  raise_fault = False 

Definition at line 25 of file

00026     def __init__(self, arg, raise_fault=False):
00027         self._comm_slot = [INVALID]
00028         self.raise_fault = raise_fault
00029         self._gen =

Member Function Documentation

Definition at line 30 of file

00031     def fetch_call(self):
00032         try:
00033             next_item =
00034         except StopIteration:
00035             return None
00036         return next_item

Definition at line 40 of file

00041     def fetch_result(self):
00042         result = self._comm_slot[0]
00043         try:
00044             if result is INVALID:
00045                 return RuntimeError("Invalid state, there is no result to fetch.")
00046             if self.raise_fault and isinstance(result, xmlrpclib.Fault):
00047                 raise result
00048             else:
00049                 return result
00050         finally:
00051             self._comm_slot[0] = INVALID

Definition at line 52 of file

00053     def run(self, arg):
00054         return NotImplementedError

Definition at line 37 of file

00038     def set_result(self, result):
00039         self._comm_slot[0] = result

Member Data Documentation

Definition at line 26 of file

Definition at line 28 of file

Definition at line 27 of file

The documentation for this class was generated from the following file: