Revision 6e99c5a0 lib/rapi/baserlib.py

b/lib/rapi/baserlib.py
188 188
    try:
189 189
      val = int(val)
190 190
    except (ValueError, TypeError), err:
191
      raise http.HttpBadRequest(message="Invalid value for the"
191
      raise http.HttpBadRequest("Invalid value for the"
192 192
                                " '%s' parameter" % (name,))
193 193
    return val
194 194

  
195
  def getBodyParameter(self, name, *args):
196
    """Check and return the value for a given parameter.
197

  
198
    If a second parameter is not given, an error will be returned,
199
    otherwise this parameter specifies the default value.
200

  
201
    @param name: the required parameter
202

  
203
    """
204
    if name in self.req.request_body:
205
      return self.req.request_body[name]
206
    elif args:
207
      return args[0]
208
    else:
209
      raise http.HttpBadRequest("Required parameter '%s' is missing" %
210
                                name)
211

  
195 212
  def useLocking(self):
196 213
    """Check if the request specifies locking.
197 214

  

Also available in: Unified diff