def directory(self): if IDirectoryBase.providedBy(self.context): return self.context elif IDirectoryItemBase.providedBy(self.context): if hasattr(IDirectoryItemBase(self.context), 'get_parent'): return self.context.get_parent() return None
def bodyClass(self, template, view): """Returns the CSS class to be used on the body tag. """ body_class = LayoutPolicy.bodyClass(self, template, view) additional_classes = ['seantis-directory-all'] if IDirectoryBase.providedBy(self.context): additional_classes.append('seantis-directory-results') if IDirectoryItemBase.providedBy(self.context): additional_classes.append('seantis-directory-item') return '{} {}'.format(body_class, ' '.join(additional_classes))