POST_ACCESS = [rapi.RAPI_ACCESS_WRITE]
DELETE_ACCESS = [rapi.RAPI_ACCESS_WRITE]
- def __init__(self, items, queryargs, req, _client_cls=luxi.Client):
+ def __init__(self, items, queryargs, req, _client_cls=None):
"""Generic resource constructor.
@param items: a list with variables encoded in the URL
self.items = items
self.queryargs = queryargs
self._req = req
+
+ if _client_cls is None:
+ _client_cls = luxi.Client
+
self._client_cls = _client_cls
def _GetRequestBody(self):
"""
AUTH_REALM = "Ganeti Remote API"
- def __init__(self):
+ def __init__(self, _client_cls=None):
# pylint: disable=W0233
# it seems pylint doesn't see the second parent class there
http.server.HttpServerHandler.__init__(self)
http.auth.HttpServerRequestAuthentication.__init__(self)
+ self._client_cls = _client_cls
self._resmap = connector.Mapper()
self._users = None
self._resmap.getController(req.request_path)
ctx = RemoteApiRequestContext()
- ctx.handler = HandlerClass(items, args, req)
+ ctx.handler = HandlerClass(items, args, req, _client_cls=self._client_cls)
method = req.request_method.upper()
try: