def items(self): items = [] page = self.context while 1: items.insert(0, { 'url': absoluteURL(page, self.request), 'title': page.title or page.__name__ }) if ISection.providedBy(page): break if ISite.providedBy(page): break page = page.__parent__ for page in items: yield page
def tabs(self): """ Return the first IPage subobject """ root = ISite.providedBy(self.page) yield { 'url': absoluteURL(self.context, self.request), 'title': 'Revista presei', 'current': root } if INews.providedBy(self.page): server = self.page.__parent__ title = getattr(server, 'title', server.__name__) if len(title) > 25: title = title[:25] + '...' yield { 'url': absoluteURL(server, self.request), 'title': title, 'current': False } if not (root or ISection.providedBy(self.page)): title = getattr(self.page, 'title', self.page.__name__) if len(title) > 25: title = title[:25] + '...' yield { 'url': absoluteURL(self.page, self.request), 'title': title, 'current': True } content = ISortedContent(self.context) for section in content.children(ISection, sort_by='order'): yield { 'url': absoluteURL(section, self.request), 'title': section.title, 'current': self.page.__name__ == section.__name__ }