def update(self): self.title = getattr(self.context, 'title', _('No title')) self.title = getattr(self.context, 'description', u'') ext = None context = self.maincontext while 1: if IExtensionsView.providedBy(context): break ext = context context = getattr(context, '__parent__', None) if IExtensionsView.providedBy(self.maincontext): self.extensionsView = True else: self.extensionsView = False self.extension = ext super(Layout, self).update()
def listExtensions(self): context = self.context.__parent__ categories = [['', IDefaultExtensionType, []]] + [ [name, tp, []] for name, tp in getUtilitiesFor(IExtensionType)] categories.sort() categories[0][0] = _('Extensions') for name, extension in getAdapters((context,), IExtension): if name and extension.isAvailable(): for name, category, list in categories: if category.providedBy(extension): list.append((extension.__title__, extension)) for name, extension in getAdapters((context, self.request), IExtension): if name and extension.isAvailable(): for name, category, list in categories: if category.providedBy(extension): list.append((extension.__title__, extension)) for name, extension, list in categories: list.sort() return categories