当前位置: 首页>>代码示例>>Python>>正文


Python PluginsHolder.getPlugin方法代码示例

本文整理汇总了Python中MaKaC.plugins.base.PluginsHolder.getPlugin方法的典型用法代码示例。如果您正苦于以下问题:Python PluginsHolder.getPlugin方法的具体用法?Python PluginsHolder.getPlugin怎么用?Python PluginsHolder.getPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MaKaC.plugins.base.PluginsHolder的用法示例。


在下文中一共展示了PluginsHolder.getPlugin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: hasRights

# 需要导入模块: from MaKaC.plugins.base import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.base.PluginsHolder import getPlugin [as 别名]
 def hasRights(request = None, user = None, plugins = []):
     """ Returns True if the user is an admin of one of the plugins corresponding to pluginNames
         plugins: a list of Plugin objects (e.g. EVO, RecordingRequest) or strings with the plugin name ('EVO', 'RecordingRequest')
                  or the string 'any' (we will then check if the user is manager of any plugin),
     """
     if not PluginsHolder().hasPluginType("Collaboration"):
         return False
     
     if user is None:
         if request is None:
             return False
         else:
             user = request._getUser()
     
     coll = PluginsHolder().getPluginType('Collaboration')
     
     if plugins == 'any':
         plugins = []
         for p in CollaborationTools.getCollaborationPluginType().getPluginList():
             plugins.append(p.getName())
     
     if plugins:
         for plugin in plugins:
             if not isinstance(plugin, Plugin):
                 plugin = coll.getPlugin(plugin)
             
             if user in plugin.getOption('admins').getValue():
                 return True
             
     return False
开发者ID:lukasnellen,项目名称:indico,代码行数:32,代码来源:collaboration.py

示例2: getPluginTPlDir

# 需要导入模块: from MaKaC.plugins.base import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.base.PluginsHolder import getPlugin [as 别名]
 def getPluginTPlDir(self, pTypeName, pluginName, tplName):
     pType = PluginsHolder().getPluginType(pTypeName)
     if pType == None:
         raise Exception(_("The plugin type does not exist"))
     if pluginName != None:
         plugin = pType.getPlugin(pluginName)
         if plugin == None:
             raise Exception(_("The plugin does not exist"))
         return posixpath.normpath(pkg_resources.resource_filename(plugin.getModule().__name__, 'tpls/{0}'.format(tplName)))
     return posixpath.normpath(pkg_resources.resource_filename(pType.getModule().__name__, 'tpls/{0}'.format(tplName)))
开发者ID:ferhatelmas,项目名称:indico,代码行数:12,代码来源:TemplateExec.py


注:本文中的MaKaC.plugins.base.PluginsHolder.getPlugin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。