Revision da04c447
b/lib/rapi/baserlib.py | ||
---|---|---|
289 | 289 |
POST_ACCESS = [rapi.RAPI_ACCESS_WRITE] |
290 | 290 |
DELETE_ACCESS = [rapi.RAPI_ACCESS_WRITE] |
291 | 291 |
|
292 |
def __init__(self, items, queryargs, req, _client_cls=luxi.Client):
|
|
292 |
def __init__(self, items, queryargs, req, _client_cls=None):
|
|
293 | 293 |
"""Generic resource constructor. |
294 | 294 |
|
295 | 295 |
@param items: a list with variables encoded in the URL |
... | ... | |
301 | 301 |
self.items = items |
302 | 302 |
self.queryargs = queryargs |
303 | 303 |
self._req = req |
304 |
|
|
305 |
if _client_cls is None: |
|
306 |
_client_cls = luxi.Client |
|
307 |
|
|
304 | 308 |
self._client_cls = _client_cls |
305 | 309 |
|
306 | 310 |
def _GetRequestBody(self): |
b/lib/server/rapi.py | ||
---|---|---|
71 | 71 |
""" |
72 | 72 |
AUTH_REALM = "Ganeti Remote API" |
73 | 73 |
|
74 |
def __init__(self): |
|
74 |
def __init__(self, _client_cls=None):
|
|
75 | 75 |
# pylint: disable=W0233 |
76 | 76 |
# it seems pylint doesn't see the second parent class there |
77 | 77 |
http.server.HttpServerHandler.__init__(self) |
78 | 78 |
http.auth.HttpServerRequestAuthentication.__init__(self) |
79 |
self._client_cls = _client_cls |
|
79 | 80 |
self._resmap = connector.Mapper() |
80 | 81 |
self._users = None |
81 | 82 |
|
... | ... | |
132 | 133 |
self._resmap.getController(req.request_path) |
133 | 134 |
|
134 | 135 |
ctx = RemoteApiRequestContext() |
135 |
ctx.handler = HandlerClass(items, args, req) |
|
136 |
ctx.handler = HandlerClass(items, args, req, _client_cls=self._client_cls)
|
|
136 | 137 |
|
137 | 138 |
method = req.request_method.upper() |
138 | 139 |
try: |
Also available in: Unified diff