本文整理汇总了Python中invenio.pluginutils.PluginContainer.get方法的典型用法代码示例。如果您正苦于以下问题:Python PluginContainer.get方法的具体用法?Python PluginContainer.get怎么用?Python PluginContainer.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类invenio.pluginutils.PluginContainer
的用法示例。
在下文中一共展示了PluginContainer.get方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get [as 别名]
def setUp(self):
"""Load plugin."""
search_service_plugins = PluginContainer(
os.path.join(CFG_SEARCH_SERVICES_PATH, '*Service.py'),
api_version=__required_plugin_API_version__,
plugin_signature=SearchService
)
self.plugin = search_service_plugins.get('JournalHintService')()
示例2: test_plugin_container_wrapping_websubmit_functions
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get [as 别名]
def test_plugin_container_wrapping_websubmit_functions(self):
"""pluginutils - wrapping websubmit functions"""
websubmit_functions = PluginContainer(os.path.join(CFG_PYLIBDIR, 'invenio', 'websubmit_functions', '*.py'))
self.failUnless(websubmit_functions['Is_Referee'])
self.failUnless(websubmit_functions['CaseEDS'])
self.failUnless(callable(websubmit_functions['CaseEDS']))
self.failUnless(len(websubmit_functions) >= 62)
## Retrieve_Data and Shared_Functions are not real plugins
self.failUnless(len(websubmit_functions.get_broken_plugins()) >= 2)
self.failIf(websubmit_functions.get('Shared_Functions'))
self.failUnless('Shared_Functions' in websubmit_functions.get_broken_plugins())
示例3: test_plugin_container_wrapping_websubmit_functions
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get [as 别名]
def test_plugin_container_wrapping_websubmit_functions(self):
"""pluginutils - wrapping websubmit functions"""
websubmit_functions = PluginContainer(os.path.join(CFG_PYLIBDIR, "invenio", "websubmit_functions", "*.py"))
self.failUnless(websubmit_functions["Is_Referee"])
self.failUnless(websubmit_functions["CaseEDS"])
self.failUnless(callable(websubmit_functions["CaseEDS"]))
self.failUnless(
len(websubmit_functions) >= 62,
"There should exist at least 62 websubmit_functions. Found: %s" % len(websubmit_functions),
)
## Retrieve_Data and Shared_Functions are not real plugins
self.failUnless(len(websubmit_functions.get_broken_plugins()) >= 2)
self.failIf(websubmit_functions.get("Shared_Functions"))
self.failUnless("Shared_Functions" in websubmit_functions.get_broken_plugins())
示例4: test_plugin_container_wrapping_external_authentications
# 需要导入模块: from invenio.pluginutils import PluginContainer [as 别名]
# 或者: from invenio.pluginutils.PluginContainer import get [as 别名]
def test_plugin_container_wrapping_external_authentications(self):
"""pluginutils - wrapping external authentications"""
def plugin_builder(plugin_name, plugin_code):
for name in dir(plugin_code):
candidate = getattr(plugin_code, name)
try:
if issubclass(candidate, ExternalAuth):
return candidate
except TypeError:
pass
raise ValueError('%s is not a valid external authentication plugin' % plugin_name)
external_authentications = PluginContainer(os.path.join(CFG_PYLIBDIR, 'invenio', 'external_authentication_*.py'), plugin_signature=ExternalAuth, plugin_builder=plugin_builder)
self.failUnless(issubclass(external_authentications['external_authentication_sso'], ExternalAuth))
self.failIf(external_authentications.get('external_authentication_cern_wrapper'))
self.failUnless(len(external_authentications) >= 1)
self.failUnless(len(external_authentications.get_broken_plugins()) >= 2)