Commit 627ad739 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

rapi: Don't access request's private object directly

This way the request handlers don't need as much knowledge
about the inside of the request and context objects and it
makes the code a bit shorter.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarIustin Pop <>
parent ab221ddf
......@@ -232,7 +232,9 @@ class R_Generic(object):
self.items = items
self.queryargs = queryargs
self.req = req
self._req = req
request_body = property(fget=lambda self: self._req.private.body_data)
def _checkIntVariable(self, name, default=0):
"""Return the parsed value of an int argument.
......@@ -273,7 +275,7 @@ class R_Generic(object):
return self.req.private.body_data[name]
return self.request_body[name]
except KeyError:
if args:
return args[0]
......@@ -256,11 +256,11 @@ class R_2_nodes_name_role(baserlib.R_Generic):
@return: a job id
if not isinstance(self.req.private.body_data, basestring):
if not isinstance(self.request_body, basestring):
raise http.HttpBadRequest("Invalid body contents, not a string")
node_name = self.items[0]
role = self.req.private.body_data
role = self.request_body
if role == _NR_REGULAR:
candidate = False
......@@ -431,12 +431,12 @@ class R_2_instances(baserlib.R_Generic):
@return: a job id
if not isinstance(self.req.private.body_data, dict):
if not isinstance(self.request_body, dict):
raise http.HttpBadRequest("Invalid body contents, not a dictionary")
beparams = baserlib.MakeParamsDict(self.req.private.body_data,
beparams = baserlib.MakeParamsDict(self.request_body,
hvparams = baserlib.MakeParamsDict(self.req.private.body_data,
hvparams = baserlib.MakeParamsDict(self.request_body,
fn = self.getBodyParameter
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment