本文整理汇总了Python中MaKaC.plugins.PluginsHolder.getPluginType方法的典型用法代码示例。如果您正苦于以下问题:Python PluginsHolder.getPluginType方法的具体用法?Python PluginsHolder.getPluginType怎么用?Python PluginsHolder.getPluginType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.plugins.PluginsHolder
的用法示例。
在下文中一共展示了PluginsHolder.getPluginType方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _checkParams
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def _checkParams(self):
optionName = self._params.get("optionName", None)
if optionName:
options = optionName.split(".")
ph = PluginsHolder()
if len(options) == 3:
pluginType, plugin, option = options
if ph.hasPluginType(pluginType):
if ph.getPluginType(pluginType).hasPlugin(plugin):
self._targetOption = ph.getPluginType(pluginType).getPlugin(plugin).getOption(option)
else:
raise ServiceError("ERR-PLUG4", "plugin: " + str(plugin) + " does not exist")
else:
raise ServiceError(
"ERR-PLUG3", "pluginType: " + str(pluginType) + " does not exist, is not visible or not active"
)
elif len(options) == 2:
pluginType, option = options
if ph.hasPluginType(pluginType):
self._targetOption = ph.getPluginType(pluginType).getOption(option)
else:
raise ServiceError(
"ERR-PLUG3", "pluginType: " + str(pluginType) + " does not exist, is not visible or not active"
)
else:
raise ServiceError(
"ERR-PLUG1", "optionName argument does not have the proper pluginType.plugin.option format"
)
else:
raise ServiceError("ERR-PLUG0", "optionName argument not present")
示例2: getVars
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def getVars(self):
ph = PluginsHolder()
tplVars = WTemplated.getVars(self)
tplVars["epayment_htdocs"] = UHEPaymentHtdocs.getURL()
tplVars["currency_data"] = ph.getPluginType('EPayment').getOption("customCurrency").getValue()
return tplVars
示例3: getOptionValueRooms
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def getOptionValueRooms(cls, pluginId, optionName):
""" Returns the room list of an option with type 'rooms' of a plugin (plugins/Collaboration/XXXXX/options.py)
pluginName: a string with the name of the plugin
optionName: a string with the name of the option
"""
ph = PluginsHolder()
return ph.getPluginType("Collaboration").getPlugin(pluginId).getOption(optionName).getRooms()
示例4: getOptionValue
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def getOptionValue(cls, pluginId, optionName):
""" Returns the value of an option of a plugin (plugins/Collaboration/XXXXX/options.py)
pluginName: a string with the name of the plugin
optionName: a string with the name of the option
"""
ph = PluginsHolder()
return ph.getPluginType("Collaboration").getPlugin(pluginId).getOption(optionName).getValue()
示例5: getList
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def getList( self ):
ph = PluginsHolder()
if ph.hasPluginType("EPayment"):
self._targetOption = ph.getPluginType("EPayment").getOption("customCurrency")
currencies = self._targetOption.getValue()
currenciesList = []
for currency in currencies:
currenciesList.append(currency["abbreviation"])
return currenciesList
else:
raise ServiceError('ERR-PLUG3', 'pluginType: ' + str("EPayment") + ' does not exist, is not visible or not active')
return [""]
示例6: _checkParams
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def _checkParams(self):
optionName = self._params.get('optionName', None)
if optionName:
options = optionName.split('.')
ph = PluginsHolder()
if len(options) == 3:
pluginType, plugin, option = options
if ph.hasPluginType(pluginType):
if ph.getPluginType(pluginType).hasPlugin(plugin):
self._targetOption = ph.getPluginType(pluginType).getPlugin(plugin).getOption(option)
else:
raise ServiceError('ERR-PLUG4', 'plugin: ' + str(plugin) + ' does not exist')
else:
raise ServiceError('ERR-PLUG3', 'pluginType: ' + str(pluginType) + ' does not exist, is not visible or not active')
elif len(options) == 2:
pluginType, option = options
if ph.hasPluginType(pluginType):
self._targetOption = ph.getPluginType(pluginType).getOption(option)
else:
raise ServiceError('ERR-PLUG3', 'pluginType: ' + str(pluginType) + ' does not exist, is not visible or not active')
else:
raise ServiceError('ERR-PLUG1', 'optionName argument does not have the proper pluginType.plugin.option format')
else:
raise ServiceError('ERR-PLUG0', 'optionName argument not present')
示例7: RHAdminPluginsBase
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
class RHAdminPluginsBase(RoomBookingDBMixin, RHAdminBase):
""" Base RH class for all plugin management requests.
It will store 2 string parameters: pluginType and pluginId.
Example: pluginType = "COllaboration" & pluginId = "EVO"
"""
def _checkParams(self, params):
RHAdminBase._checkParams(self, params)
self._pluginType = params.get("pluginType", None)
#take out white spaces in case there are some
if self._pluginType:
self._pluginType = self._pluginType.replace(' ', '')
self._pluginId = params.get("pluginId", None)
#take out white spaces in case there are some
if self._pluginId:
self._pluginId = self._pluginId.replace(' ', '')
self._ph = PluginsHolder()
if self._pluginType and not self._ph.hasPluginType(self._pluginType, mustBeActive = False):
raise PluginError("The plugin type " + self._pluginType + " does not exist or is not visible")
elif self._pluginType and self._pluginId and not self._ph.getPluginType(self._pluginType).hasPlugin(self._pluginId):
raise PluginError("The plugin " + self._pluginId + " does not exist")
示例8: runTests
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def runTests(host='localhost', port=FAKE_SERVICE_PORT,
scenarios=[(2, 10)]):
execTimes = []
agent = InvenioBatchUploaderAgent('test1', 'test1', 'test',
0, 'http://%s:%s' \
% (host, port))
ph = PluginsHolder()
ph.reloadAllPlugins()
ph.getPluginType('livesync').toggleActive()
do = DummyObservable()
do._notify('updateDBStructures', 'indico.ext.livesync',
None, None, None)
sm = SyncManager.getDBInstance()
sm.registerNewAgent(agent)
cm = CategoryManager()
avatar = user.Avatar()
avatar.setName( "fake" )
avatar.setSurName( "fake" )
avatar.setOrganisation( "fake" )
avatar.setLang( "en_GB" )
avatar.setEmail( "[email protected]" )
#registering user
ah = user.AvatarHolder()
ah.add(avatar)
#setting up the login info
li = user.LoginInfo( "dummyuser", "dummyuser" )
ih = AuthenticatorMgr()
userid = ih.createIdentity( li, avatar, "Local" )
ih.add( userid )
#activate the account
avatar.activateAccount()
#since the DB is empty, we have to add dummy user as admin
minfo = HelperMaKaCInfo.getMaKaCInfoInstance()
al = minfo.getAdminList()
al.grant( avatar )
dummy = avatar
ContextManager.destroy()
HelperMaKaCInfo.getMaKaCInfoInstance().setDefaultConference(DefaultConference())
cm.getRoot()
do._notify('requestStarted')
home = cm.getById('0')
# execute code
for nconf in range(0, 1000):
conf = home.newConference(dummy)
conf.setTitle('Test Conference %s' % nconf)
do._notify('requestFinished')
time.sleep(1)
# params won't be used
task = LiveSyncUpdateTask(dateutil.rrule.MINUTELY)
for scen in scenarios:
print "Scenario %s workers, size = %s " % scen,
# configure scenario
InvenioBatchUploaderAgent.NUM_WORKERS = scen[0]
InvenioBatchUploaderAgent.BATCH_SIZE = scen[1]
ts = time.time()
# just run it
task.run()
te = time.time()
execTimes.append(te - ts)
print "%s" % (te - ts)
sm._track._pointers['test1'] = None
for i in range(0, len(execTimes)):
results[scenarios[i]] = execTimes[i]
示例9: _checkParams
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def _checkParams(self):
AdminService._checkParams(self)
ph = PluginsHolder()
self._targetOption = ph.getPluginType("EPayment").getOption("customCurrency")
self._currencyName = self._params.get("name", None)
self._currencies = self._targetOption.getValue()
示例10: getCustomerUsername
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def getCustomerUsername(self):
ph = PluginsHolder()
return ph.getPluginType("EPayment").getPlugin("eWay").getOption("customer_username").getValue()
示例11: getUrl
# 需要导入模块: from MaKaC.plugins import PluginsHolder [as 别名]
# 或者: from MaKaC.plugins.PluginsHolder import getPluginType [as 别名]
def getUrl(self):
ph = PluginsHolder()
return ph.getPluginType("EPayment").getPlugin("eWay").getOption("url").getValue()