Revision e0e916fe lib/rpc.py

b/lib/rpc.py
151 151
  return decorator
152 152

  
153 153

  
154
def RunWithRPC(fn):
155
  """RPC-wrapper decorator.
156

  
157
  When applied to a function, it runs it with the RPC system
158
  initialized, and it shutsdown the system afterwards. This means the
159
  function must be called without RPC being initialized.
160

  
161
  """
162
  def wrapper(*args, **kwargs):
163
    Init()
164
    try:
165
      return fn(*args, **kwargs)
166
    finally:
167
      Shutdown()
168
  return wrapper
169

  
170

  
154 171
class RpcResult(object):
155 172
  """RPC Result class.
156 173

  

Also available in: Unified diff