Esempio n. 1
0
    def new_search_tag(self, name, query, attributes={}):
        """
        Create a new search tag

        @returns GTG.core.tag.Tag: the new search tag/None for a invalid query
        """
        try:
            parameters = parse_search_query(query)
        except InvalidQuery as e:
            Log.warning("Problem with parsing query '%s' (skipping): %s" %
                        (query, e.message))
            return None

        # Create own copy of attributes and add special attributes label, query
        init_attr = dict(attributes)
        init_attr["label"] = name
        init_attr["query"] = query

        tag = Tag(name, req=self.requester, attributes=init_attr)
        self._add_new_tag(name,
                          tag,
                          search_filter,
                          parameters,
                          parent_id=SEARCH_TAG)
        self.save_tagtree()
        return tag
Esempio n. 2
0
    def new_search_tag(self, name, query, attributes={}):
        """
        Create a new search tag

        @returns GTG.core.tag.Tag: the new search tag/None for a invalid query
        """
        try:
            parameters = parse_search_query(query)
        except InvalidQuery, e:
            Log.warning("Problem with parsing query '%s' (skipping): %s" %
                       (query, e.message))
            return None
Esempio n. 3
0
    def new_search_tag(self, name, query, attributes={}):
        """
        Create a new search tag

        @returns GTG.core.tag.Tag: the new search tag/None for a invalid query
        """
        try:
            parameters = parse_search_query(query)
        except InvalidQuery, e:
            Log.warning("Problem with parsing query '%s' (skipping): %s" %
                        (query, e.message))
            return None
Esempio n. 4
0
    def task_tags_column(self, node):
        tags = node.get_tags()

        search_parent = self.req.get_tag(CoreConfig.SEARCH_TAG)
        for search_tag in search_parent.get_children():
            tag = self.req.get_tag(search_tag)
            match = search_filter(node,
                                  parse_search_query(
                                  tag.get_attribute('query')))
            if match and search_tag not in tags:
                tags.append(tag)

        tags.sort(key=lambda x: x.get_name())
        return tags
Esempio n. 5
0
    def task_tags_column(self, node):
        tags = node.get_tags()

        search_parent = self.req.get_tag(CoreConfig.SEARCH_TAG)
        for search_tag in search_parent.get_children():
            tag = self.req.get_tag(search_tag)
            match = search_filter(node,
                                  parse_search_query(
                                  tag.get_attribute('query')))
            if match and search_tag not in tags:
                tags.append(tag)

        tags.sort(key=lambda x: x.get_name())
        return tags
Esempio n. 6
0
 def SearchTasks(self, query):
     """
     Searches the task list
     """
     tree = self.req.get_tasks_tree().get_basetree()
     view = tree.get_viewtree()
     try:
         search = parse_search_query(query)
         view.apply_filter('search', parameters=search)
         tasks = view.get_all_nodes()
         if tasks:
             return [self.GetTask(id) for id in tasks]
     except InvalidQuery:
         pass
     return dbus.Array([], "s")
Esempio n. 7
0
 def SearchTasks(self, query):
     """
     Searches the task list
     """
     tree = self.req.get_tasks_tree().get_basetree()
     view = tree.get_viewtree()
     try:
         search = parse_search_query(query)
         view.apply_filter('search', parameters=search)
         tasks = view.get_all_nodes()
         if tasks:
             return [self.GetTask(id) for id in tasks]
     except InvalidQuery:
         pass
     return dbus.Array([], "s")
Esempio n. 8
0
    def get_task_tags_column_contents(self, node):
        """Returns an ordered list of tags of a task"""
        tags = node.get_tags()

        search_parent = self.req.get_tag(SEARCH_TAG)
        for search_tag in search_parent.get_children():
            tag = self.req.get_tag(search_tag)
            match = search_filter(
                node,
                parse_search_query(tag.get_attribute('query')),
            )
            if match and search_tag not in tags:
                tags.append(tag)

        tags.sort(key=lambda x: x.get_name())
        return tags
Esempio n. 9
0
    def new_search_tag(self, name, query, attributes={}):
        """
        Create a new search tag

        @returns GTG.core.tag.Tag: the new search tag/None for a invalid query
        """
        try:
            parameters = parse_search_query(query)
        except InvalidQuery as e:
            Log.warning("Problem with parsing query '%s' (skipping): %s" % (query, e.message))
            return None

        # Create own copy of attributes and add special attributes label, query
        init_attr = dict(attributes)
        init_attr["label"] = name
        init_attr["query"] = query

        tag = Tag(name, req=self.requester, attributes=init_attr)
        self._add_new_tag(name, tag, search_filter, parameters, parent_id=SEARCH_TAG)
        self.save_tagtree()
        return tag