def isVisible(self, instance, mode='view'): """ Check if we are contained in an Article """ container = aq_parent(instance) if IArticle.providedBy(container): return 'visible' return 'invisible'
def available(self): if IArticle.providedBy(self.context): return False try: self.context.Schema()['components'] except: return False return True
def visible(self): if IArticle.providedBy(self.context): if self.manager.__name__=='plone.leftcolumn': hideLeftSlot = self.context.Schema().get('hideLeftPortletslot').get(self.context) if hideLeftSlot: return False if self.manager.__name__=='plone.rightcolumn': hideRightSlot = self.context.Schema().get('hideRightPortletslot').get(self.context) if hideRightSlot: return False return super(ArticlePortletManagerRenderer, self).visible
def get_containing_article(self, context): """Get the Article that this Item is contained in.""" container = aq_parent(context) # if this item is just being created we need to move higher # up the inheritance tree to reach it's actual parent Article if context.isTemporary() and isinstance(container, TempFolder): container = aq_parent(aq_parent(container)) # return False for containers that are not Articles if not IArticle.providedBy(container): return False return container