Exemple #1
0
    def parse_tags(task):
        """
        Uses the tags entry in the task to render a user-friendly display of
        the actions and resources involved in the task.

        @param task: object representation of the task
        @type  task: Task

        @return: tuple of list of actions and list of resources involved
        @rtype:  ([], [])
        """

        actions = []
        resources = []

        if task.tags is None:
            return actions, resources

        for t in task.tags:
            if tag_utils.is_resource_tag(t):
                resource_type, resource_id = tag_utils.parse_resource_tag(t)
                resources.append('%s (%s)' % (resource_id, resource_type))
            else:
                tag_value = tag_utils.parse_value(t)
                actions.append(tag_value)

        return actions, resources
Exemple #2
0
    def parse_tags(task):
        """
        Uses the tags entry in the task to render a user-friendly display of
        the actions and resources involved in the task.

        @param task: object representation of the task
        @type  task: Task

        @return: tuple of list of actions and list of resources involved
        @rtype:  ([], [])
        """

        actions = []
        resources = []

        if task.tags is None:
            return actions, resources

        for t in task.tags:
            if tag_utils.is_resource_tag(t):
                resource_type, resource_id = tag_utils.parse_resource_tag(t)
                resources.append('%s (%s)' % (resource_id, resource_type))
            else:
                tag_value = tag_utils.parse_value(t)
                actions.append(tag_value)

        return actions, resources