return None def get_addables(self, requires=None, excepts=None): addables = [addable.meta_type for addable in self._silva_addables] if any((requires, excepts)): return filter_types_for_interfaces(addables, requires, excepts) return addables def get_contents(self, requires=None, excepts=None): contents = [addable.content_type for addable in self._silva_addables] if any((requires, excepts)): return filter_types_for_interfaces(contents, requires, excepts) return contents def get_addable(self, content_type): for addable in self._silva_addables: if content_type == addable.meta_type['name']: return addable.meta_type return {} extensionRegistry = ExtensionRegistry() # Cleanup registry on layer tearDown try: from infrae.testing import layerCleanUp except ImportError: pass else: layerCleanUp.add(extensionRegistry.clear_registry)
fs_path = os.path.join(extension.module_directory, icon) name = ''.join(( 'icon-', cls.meta_type.strip().replace(' ', '-'), os.path.splitext(icon)[1] or '.png')) factory = IconResourceFactory(name, fs_path) config.action( discriminator = ('resource', name, IHTTPRequest, Interface), callable = provideAdapter, args = (factory, (IHTTPRequest,), Interface, name)) icon = Icon("++resource++" + name) icon_registry.register(('meta_type', cls.meta_type), icon) cls.icon = icon.icon def cleanUp(): global _meta_type_regs Products.meta_types = tuple([ info for info in Products.meta_types if info['name'] not in _meta_type_regs ]) _meta_type_regs = [] try: from infrae.testing import layerCleanUp except ImportError: pass else: layerCleanUp.add(cleanUp)