Esempio n. 1
0
def resource_dict_to_call_resources(resource_dict):
    """
    Convert a resources dictionary to a list of task resource instances
    @param resource_dict: dict in the form of {resource_type: {resource_id: [operations list]}}
    @type  resource_dict: dict
    @return: list of call resource objects pertaining to the values of the resource_dict
    @rtype:  list of L{CallResource} instances
    """
    call_resources = []
    for resource_type, resource_operations in resource_dict.items():
        for resource_id, operation in resource_operations.items():
            call_resource = CallResource(None, resource_type, resource_id,
                                         operation)
            call_resources.append(call_resource)
    return call_resources