def render(self): # XXX kludgy: we don't want to show this menu item for IArticle. # To do that, we want to override the viewlet for IArticle, # but we can't do that if we register this for IRepositoryContent, # since that is orthogonal to the type, while ICMSContent is # a superclass of IArticle. if not IRepositoryContent.providedBy(self.context): return '' return super(WorkflowMenuItem, self).render()
def __parent__(self): if hasattr(self, '__explicit_parent__'): return self.__explicit_parent__ if not IRepositoryContent.providedBy(self): # This most likely means we're somewhere inside a workingcopy. The # default value in zope.container.Contained is None, and we also # need to handle bw-compat for ILocalContent objects that existed # before __explicit_parent__ was introduced. return self.__dict__.get('__parent__') unique_id = self.uniqueId trailing_slash = unique_id.endswith('/') if trailing_slash: unique_id = unique_id[:-1] parent_id = os.path.dirname(unique_id) parent_id = parent_id.rstrip('/') + '/' repository = zope.component.getUtility( zeit.cms.repository.interfaces.IRepository) # "root" edge case part 1a: We use the repository itself as the '/' # folder, it serves as the traversal root for DAV content if parent_id == repository.uniqueId: return repository return repository.getContent(parent_id)
def visible(self): return IRepositoryContent.providedBy(self.context) and \ not IPublishInfo(self.context).published
def render(self): if IRepositoryContent.providedBy(self.context): return '' return super(EditContentsMenuItem, self).render()
def render(self): if not self.visible or not IRepositoryContent.providedBy(self.context): return '' else: return super(RetractMenuItem, self).render()