コード例 #1
0
 def getTerm(self, value):
     if not value:
         return None
     if (not self.context.portal_path.endswith('/')) \
             and (not value.startswith('/')):
         value = '/' + value
     # get rid for path
     rid = self.context.catalog.getrid(self.context.portal_path + value)
     # first some defaults
     token = value
     title = value
     browse_token = None
     parent_token = None
     if rid is not None:
         # fetch the brain from the catalog
         brain = self.context.catalog._catalog[rid]
         title = brain.Title
         # title = brain.Title
         if brain.is_folderish:
             browse_token = value
         parent_token = '/'.join(value.split('/')[:-1])
     return BrowsableTerm(value, token=token,
                          title=title.decode(self.context.encoding),
                          description=value,
                          browse_token=browse_token,
                          parent_token=parent_token)
コード例 #2
0
 def getTerm(self, value):
     if not (value[0] == '.'):
         return super(RelPathQSTSourceView, self).getTerm(value)
     terms = RELPATHVOC
     token = value
     title = terms.get(value, value)
     browse_token = parent_token = None
     return BrowsableTerm(value,
                          token=token,
                          title=title,
                          description=value,
                          browse_token=browse_token,
                          parent_token=parent_token)