コード例 #1
0
ファイル: cache.py プロジェクト: cyphactor/lifecyclemanager
    def wiki_page_deleted(self, page):
        """Called when a page has been deleted.
        
        This basically takes the page that was deleted and removes all
        relationships from the database mapping requirements to this
        wiki page because the wiki page no longer exists.
        """
        
        refs = RequirementCacheSystem(self.env).parse_data_for_req_references(page.text)

        if refs:
            for (component, fp, object) in refs:
                req_wiki_cache = RequirementWikiCache(self.env, component, fp, object, page.name, page.version)
                if (req_wiki_cache.exists):
                    req_wiki_cache.delete_by_page()
コード例 #2
0
ファイル: cache.py プロジェクト: cyphactor/lifecyclemanager
    def wiki_page_changed(self, page, version, t, comment, author, ipnr):
        """Called whenever a page has been modified.
        
        This basically takes the page and finds the changes, and if the
        changes effect requirement references to this wiki page then
        the relationships in the database are updated properly to
        reflect the changes.
        """
        
        refs = RequirementCacheSystem(self.env).parse_data_for_req_references(page.text)

        if refs:
            for (component, fp, object) in refs:
                req_wiki_cache = RequirementWikiCache(self.env, component, fp, object, page.name, version)
                if not (req_wiki_cache.exists):
                    req_wiki_cache.insert()
コード例 #3
0
ファイル: cache.py プロジェクト: cyphactor/lifecyclemanager
    def wiki_page_added(self, page):
        """Called whenever a new Wiki page is added.
        
        This basically takes the page data and parses it for references
        to requirements and then creates a relationship map between
        requirements and this wiki page. Note: There should be no need
        to check for duplicates or deletions because this is when a wiki
        page is just being created.
        """
        
        refs = RequirementCacheSystem(self.env).parse_data_for_req_references(page.text)

        if refs:
            for (component, fp, object) in refs:
                req_wiki_cache = RequirementWikiCache(self.env, component, fp, object, page.name, page.version)
                if not (req_wiki_cache.exists):
                    req_wiki_cache.insert()
コード例 #4
0
ファイル: cache.py プロジェクト: cyphactor/lifecyclemanager
 def index_wikis(self, db=None):
     """Index all requirement references found in wikis.
     
     Iterate through all the wiki pages, their invidual, and their
     associated comments in the database parsing them for references
     to requirements. If new references are found then they are
     added appropriately to the database cache tables.
     """
     
     if not db:
         db = self.env.get_db_cnx()
     cursor = db.cursor()
     
     if (self._need_index_wikis()):
         # Select all the wikis from the wiki table and parse them
         # all for any references to requirements. If any
         # requirement references exist, create a
         # RequirementWikiCache object for it and insert it into
         # the database if it does not already exist in the databse.
         cursor.execute("SELECT name, version, text, comment FROM wiki")
         for name, version, text, comment in cursor:
             # parse the wiki text and create references
             if text:
                 refs = self.parse_data_for_req_references(text)
             
                 if refs:
                     for (component, fp, object) in refs:
                         req_wiki_cache = RequirementWikiCache(self.env, component, fp, object, name, version)
                         if not (req_wiki_cache.exists):
                             req_wiki_cache.insert(db=db)
             
             # parse the comment and create references
             if comment:
                 refs = self.parse_data_for_req_references(comment)
             
                 if refs:
                     for (component, fp, object) in refs:
                         req_wiki_cache = RequirementWikiCache(self.env, component, fp, object, name, version)
                         if not (req_wiki_cache.exists):
                             req_wiki_cache.insert(db=db)