Ejemplo n.º 1
0
 def linkDetection(self, text):
     """
     Detects issues and svn revision tags and creates links.
     """
     # In case we get something not string like, we just return
     # text without change
     if not isinstance(text, basestring):
         return text
     catalog = getToolByName(self, 'portal_catalog')
     issuefolder = self.restrictedTraverse('@@issuefolder')
     issues = catalog.searchResults(issuefolder.buildIssueSearchQuery(None))
     ids = frozenset([issue.id for issue in issues])
     text = linkBugs(text, ids, ISSUE_RECOGNITION_PATTERNS,
                     base_url=self.absolute_url())
     svnUrl = self.getSvnUrl()
     text = linkSvn(text, svnUrl, REVISION_RECOGNITION_PATTERNS)
     return text
Ejemplo n.º 2
0
    def linkDetection(self, text):
        """
        Detects issues and svn revision tags and creates links.
        """
        # In case we get something not string like, we just return
        # text without change
        if not isinstance(text, basestring):
            return text
        catalog = getToolByName(self, 'portal_catalog')
        issuefolder = self.restrictedTraverse('@@issuefolder')
        issues = catalog.searchResults(issuefolder.buildIssueSearchQuery(None))
        ids = frozenset([issue.id for issue in issues])

        # XXX/TODO: should these patterns live in the config file?
        text = linkBugs(text, ids, [
            '#[1-9][0-9]*', 'issue:[1-9][0-9]*', 'ticket:[1-9][0-9]*',
            'bug:[1-9][0-9]*'
        ])
        svnUrl = self.getSvnUrl()
        text = linkSvn(text, svnUrl,
                       ['r[0-9]+', 'changeset:[0-9]+', '\[[0-9]+\]'])

        return text