コード例 #1
0
 def publishTraverse(self, request, name):
     try:
         content = self.current_target.unrestrictedTraverse(name)
         if IPermanentRedirectLink.providedBy(content):
             self.context = content
             self.current_target = content.get_target()
             if self.current_target is None:
                 raise NotFound(name)
             self.extra = []
         else:
             self.current_target = content
             self.extra.append(name)
         return self
     except (NotFound, AttributeError):
         raise NotFound(name)
コード例 #2
0
 def search_document(self, name):
     if not hasattr(self.context, name):
         return None
     content = getattr(self.context, name).get_silva_object()
     if IContainer.providedBy(content):
         content = content.get_default()
         if content is None:
             return None
     if IPermanentRedirectLink.providedBy(content):
         return None
     version = content.get_viewable()
     if IGhost.providedBy(content):
         content = version.get_haunted()
         version = content.get_viewable()
     if version is not None:
         details = queryMultiAdapter((version, self.request),
                                     IDocumentDetails)
         if details is not None:
             return details.get_text()
     return None
コード例 #3
0
 def search_document(self, name):
     if not hasattr(self.context, name):
         return None
     content = getattr(self.context, name).get_silva_object()
     if IContainer.providedBy(content):
         content = content.get_default()
         if content is None:
             return None
     if IPermanentRedirectLink.providedBy(content):
         return None
     version = content.get_viewable()
     if IGhost.providedBy(content):
         content = version.get_haunted()
         version = content.get_viewable()
     if version is not None:
         details = queryMultiAdapter(
             (version, self.request), IDocumentDetails)
         if details is not None:
             return details.get_text()
     return None