Functions | |
def | _check_type (value, expected_types) |
Private functions. More... | |
def | date_to_dict (date) |
Public API functions. More... | |
def | get_direct_child_elements_xml (node, prefix=None, local_name=None) |
def | indent_string (string, num_spaces=2) |
def | parse_properties_xml (node) |
def | properties_to_xml (element, name, value=None) |
def | validate_attribute (attr, name, expected_type=None, required=False) |
Variables | |
string | __version__ = '$Revision: $' |
|
private |
def rtsprofile.utils.date_to_dict | ( | date | ) |
def rtsprofile.utils.get_direct_child_elements_xml | ( | node, | |
prefix = None , |
|||
local_name = None |
|||
) |
def rtsprofile.utils.indent_string | ( | string, | |
num_spaces = 2 |
|||
) |
def rtsprofile.utils.properties_to_xml | ( | element, | |
name, | |||
value = None |
|||
) |
def rtsprofile.utils.validate_attribute | ( | attr, | |
name, | |||
expected_type = None , |
|||
required = False |
|||
) |
Validates that an attribute meets expectations. This function will check if the given attribute value matches a necessary type and/or is not None, an empty string, an empty list, etc. It will raise suitable exceptions on validation failure. @param attr The value to validate. @param name The attribute name to use in exceptions. @param expected_type The type the value must be. If None, no check is performed. If a list, attr must match one type in the list. @param required If the value must not be empty, e.g. not an empty string. @raises InvalidTypeError @raises RequiredAttributeError