def __call__(self, content): if not IViewableObject.providedBy(content): return True item = self.get(content) # Item is none will account for unpublished content. return ((item is None) or (self.metadata(item, 'silva-settings', 'hide_from_tocs') == 'hide'))
def __call__(self, content): if not IViewableObject.providedBy(content): return True item = self.get(content) # Item is none will account for unpublished content. return ( (item is None) or (self.metadata(item, 'silva-settings', 'hide_from_tocs') == 'hide'))
def configure_content(self, root, extension): """Configure extension content: metadata, addables, security. """ contents = extension.get_content() # Configure addables if not self._is_installed.addables: addables = [] not_addables = [] for content in contents: if self.is_silva_addable(content): if content['name'] not in self.not_globally_addables: addables.append(content['name']) else: not_addables.append(content['name']) self.configure_addables(root, addables, not_addables) # Configure security if not self._is_installed.security: secured_contents = [] for content in contents: if self.is_silva_content(content): secured_contents.append(content['name']) self.configure_security(root, secured_contents) # Configure metadata if not self._is_installed.metadata: viewables = [] others = [] for content in contents: if self.has_default_metadata(content): if (IViewableObject.implementedBy(content['instance']) or IVersion.implementedBy(content['instance'])): viewables.append(content['name']) else: others.append(content['name']) if viewables: root.service_metadata.addTypesMapping( viewables, ('silva-content', 'silva-extra', 'silva-settings')) if others: root.service_metadata.addTypesMapping( others, ('silva-content', 'silva-extra'))