Remote API base resources library.
Class |
|
Acts as a structure containing the per-method attribute names. |
Class |
|
Base class for opcode-based RAPI resources. |
Class |
|
Generic class for resources. |
Function |
|
Builds a URI list as used by index resources. |
Function |
|
Check and return the value for a given parameter. |
Function |
|
Abort request if value type doesn't match expected type. |
Function |
|
Feedback logging function for jobs. |
Function |
|
Fills an opcode with body parameters. |
Function |
|
Undocumented |
Function |
|
Returns the access rights for a method on a handler. |
Function |
|
Returns all opcodes used by a resource. |
Function |
|
Converts errors when querying a single item. |
Function |
|
Inspects a dictionary of params, looking for forbidden values. |
Function |
|
Map value to field name in to one dictionary. |
Function |
|
Maps two lists into one dictionary. |
Function |
|
Turns a list of parameter names and possibly values into a dictionary. |
Constant | ALL |
Undocumented |
Constant | OPCODE |
Undocumented |
Class | _ |
Meta class for RAPI resources. |
Function | _ |
Builds list of attributes used for per-handler opcodes. |
Constant | _DEFAULT |
Undocumented |
Constant | _SUPPORTED |
Undocumented |
Builds a URI list as used by index resources.
Parameters | |
ids | list of ids as strings |
uri | format to be applied for URI |
uri | optional parameter for field IDs |
Check and return the value for a given parameter.
If no default value was given and the parameter doesn't exist in the input data, an error is raise.
Parameters | |
data:dict | Dictionary containing input data |
name:string | Parameter name |
default | Default value (can be None) |
exptype | Expected type (can be None) |
Abort request if value type doesn't match expected type.
Parameters | |
value | Value |
exptype:type | Expected type |
descr:string | Description of value |
Returns | |
Value (allows inline usage) |
Feedback logging function for jobs.
We don't have a stdout for printing log messages, so log them to the http log at least.
Parameters | |
msg | the message |
Fills an opcode with body parameters.
Parameter types are checked.
Parameters | |
opcls:opcodes.OpCode | Opcode class |
body:dict | Body parameters as received from client |
static:dict | Static parameters which can't be modified by client |
rename:dict | Renamed parameters, key as old name, value as new name |
Returns | |
Opcode object |
Returns the access rights for a method on a handler.
Parameters | |
handler:ResourceBase | Undocumented |
method:string | Undocumented |
Returns | |
string or None | Undocumented |
Inspects a dictionary of params, looking for forbidden values.
Parameters | |
params | A dictionary of supplied parameters |
forbidden | The forbidden parameters, with a list of forbidden values or the constant ALL_VALUES_FORBIDDEN signifying that all values are forbidden |
rename | The list of parameter renamings used by the method |
Raises | |
http.HttpForbidden | If a forbidden param has been set |
Map value to field name in to one dictionary.
Parameters | |
itemslist | a list of items values |
fields | a list of items names |
Returns | |
a list of mapped dictionaries |
Maps two lists into one dictionary.
Example:
>>> MapFields(["a", "b"], ["foo", 123]) {'a': 'foo', 'b': 123}
Parameters | |
names | field names (list of strings) |
data | field data (list) |
Turns a list of parameter names and possibly values into a dictionary.
Parameters | |
class | The name of the handler class |
method | The name of the HTTP method |
param | A list of forbidden parameters, specified in the RAPI handler class |
Returns | |
The dictionary of forbidden param names to values or ALL_VALUES_FORBIDDEN |
Undocumented
Value |
|