예제 #1
0
    def ticket_deleted(self, ticket):
        """Called when a ticket is deleted.

        This basically takes the ticket that was deleted and
        removes all relationships from the database mapping requirements
        to the the ticket.
        """

        req_ticket_cache = RequirementTicketCache(self.env, ticket.id)
        if (req_ticket_cache.ticket_in_table):
            req_ticket_cache.delete()
예제 #2
0
    def ticket_changed(self, ticket, comment, author, old_values):
        """Called when a ticket is modified.
        
        The method takes the ticket, deletes the old relationships 
        mapping requirements to the ticket and creates new ones.
        """
       
        # delete all old information related to this ticket:
        req_ticket_cache = RequirementTicketCache(self.env, ticket.id)
        if (req_ticket_cache.ticket_in_table):
            req_ticket_cache.delete()

        # insert current information:
        searchfields = ['summary', 'description', 'keywords']
        
        for field in searchfields:
            refs = RequirementCacheSystem( \
                       self.env).parse_data_for_req_references(ticket[field])

            if refs:
                for (component, fp, object) in refs:
                    req_ticket_cache = RequirementTicketCache(self.env,
                                                              ticket.id,
                                                              component,
                                                              fp,
                                                              object)
                    if not (req_ticket_cache.exists):
                        req_ticket_cache.insert()

        # insert information gleaned from the comment history:
        comments = self._get_comments(ticket.id)

        if comments:
            for comment in comments:
                refs = RequirementCacheSystem( \
                           self.env).parse_data_for_req_references(comment)

                if refs:
                    for (component, fp, object) in refs:
                        req_ticket_cache = RequirementTicketCache(self.env,
                                                                  ticket.id,
                                                                  component,
                                                                  fp,
                                                                  object)
                        if not (req_ticket_cache.exists):
                            req_ticket_cache.insert()