Package restxclient :: Module restx_parameter :: Class RestxParameter
[hide private]
[frames] | no frames]

Class RestxParameter

source code

object --+
         |
        RestxParameter

Represents a parameter for a RESTx resource or service.

This is a representation of the parameter's definition, not of the parameter's value.

Instance Methods [hide private]
 
__str__(self)
Return a string representation of this paramater.
source code
 
__init__(self, name, pdef)
Create a new parameter definition representation in memory.
source code
 
sanity_check(self, value)
Check whether this is a valid value for this parameter.
source code
string
get_name(self)
Return the name of the parameter.
source code
string
get_description(self)
Return the description of the parameter.
source code
string
get_parameter_type_str(self)
Return the string representation of the type of this parameter.
source code
Whichever type the default value has.
get_default_value(self)
Return the default value, if one was set.
source code
boolean
is_required(self)
Indicate whether this is a required parameter.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Variables [hide private]
  __DESC_KEY = 'desc'
  __REQUIRED_KEY = 'required'
  __TYPE_KEY = 'type'
  __DEFAULT_KEY = 'default'
  __name = None
  __desc = None
  __required = None
  __default_val = None
  __type_str = None
  __PARAM_STRING = 'string'
  __PARAM_PASSWORD = 'password'
  __PARAM_BOOL = 'boolean'
  __PARAM_DATE = 'date'
  __PARAM_TIME = 'time'
  __PARAM_NUMBER = 'number'
  __PARAM_URI = 'uri'
  __TYPE_CONVERT = {'boolean': ([<type 'str'>, <type 'unicode'>,...
Properties [hide private]
string name
Return the name of the parameter.
string description
Return the description of the parameter.
boolean required
Indicate whether this is a required parameter.
string type_str
Return the string representation of the type of this parameter.

Inherited from object: __class__

Method Details [hide private]

__str__(self)
(Informal representation operator)

source code 

Return a string representation of this paramater.

Overrides: object.__str__

__init__(self, name, pdef)
(Constructor)

source code 

Create a new parameter definition representation in memory.

Parameters:
  • name (string) - Name of the parameter.
  • pdef (dict) - Dictionary with parameter definition. This is the dictionary returned by the server when describing a parameter.
Overrides: object.__init__

sanity_check(self, value)

source code 

Check whether this is a valid value for this parameter.

Raises an exception if there's a problem.

Parameters:
  • value (object) - Some value object.

get_name(self)

source code 

Return the name of the parameter.

Returns: string
Name of parameter.

get_description(self)

source code 

Return the description of the parameter.

Returns: string
Description of parameter.

get_parameter_type_str(self)

source code 

Return the string representation of the type of this parameter.

Returns: string
String representation of parameter type.

get_default_value(self)

source code 

Return the default value, if one was set.

Returns: Whichever type the default value has.
The default value, or None.

is_required(self)

source code 

Indicate whether this is a required parameter.

Returns: boolean
Flag, which is True if required, False otherwise.

Class Variable Details [hide private]

__TYPE_CONVERT

Value:
{'boolean': ([<type 'str'>, <type 'unicode'>, <type 'bool'>],
             <function _bool_convert at 0x9b5002c>),
 'date': ([None], <function <lambda> at 0x9b5009c>),
 'number': ([<type 'str'>,
             <type 'unicode'>,
             <type 'int'>,
             <type 'float'>],
            <function _numstr_to_num at 0x9a3bfb4>),
...

Property Details [hide private]

name

Return the name of the parameter.

Get Method:
get_name(self) - Return the name of the parameter.
Type:
string

description

Return the description of the parameter.

Get Method:
get_description(self) - Return the description of the parameter.
Type:
string

required

Indicate whether this is a required parameter.

Get Method:
is_required(self) - Indicate whether this is a required parameter.
Type:
boolean

type_str

Return the string representation of the type of this parameter.

Get Method:
get_parameter_type_str(self) - Return the string representation of the type of this parameter.
Type:
string