本文整理汇总了Python中MaKaC.plugins.base.PluginsHolder类的典型用法代码示例。如果您正苦于以下问题:Python PluginsHolder类的具体用法?Python PluginsHolder怎么用?Python PluginsHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PluginsHolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hasRights
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
示例2: getUpdateInterval
def getUpdateInterval(self):
"""
Returns the interval for which cached values should live before
new data is requested from the server.
"""
statsPlugin = PluginsHolder().getPluginType('statistics')
return statsPlugin.getOptions()['cacheTTL'].getValue()
示例3: getOptionValue
def getOptionValue(cls, pluginName, 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(pluginName).getOption(optionName).getValue()
示例4: meetingAndLectureDisplay
def meetingAndLectureDisplay(cls, obj, params):
out = params['out']
conf = params['conf']
if DBHelpers.roomsToShow(conf):
linksList = PluginsHolder().getPluginType('InstantMessaging').getOption('customLinks').getValue()
out.openTag("chatrooms")
for chatroom in DBHelpers.getShowableRooms(conf):
out.openTag("chatroom")
out.writeTag("id", chatroom.getId())
out.writeTag("name", chatroom.getTitle())
out.writeTag("server", 'conference.' + chatroom.getHost() if chatroom.getCreatedInLocalServer() else chatroom.getHost())
out.writeTag("description", chatroom.getDescription())
out.writeTag("reqPassword", _('Yes') if chatroom.getPassword() else _('No'))
out.writeTag("showPassword", chatroom.getShowPass())
out.writeTag("password", chatroom.getPassword())
out.writeTag("createdInLocalServer", chatroom.getCreatedInLocalServer())
out.openTag("links")
if linksList.__len__() > 0:
out.writeTag("linksToShow", 'true')
else:
out.writeTag("linksToShow", 'false')
for link in linksList:
out.openTag("customLink")
out.writeTag("name", link['name'])
out.writeTag("structure", GeneralLinkGenerator(chatroom, link['structure']).generate())
out.closeTag("customLink")
out.closeTag("links")
out.closeTag("chatroom")
out.closeTag("chatrooms")
out.writeTag("how2connect", PluginFieldsWrapper('InstantMessaging', 'XMPP').getOption('ckEditor'))
示例5: toIndex
def toIndex(obj):
plugin = PluginsHolder().getPluginType('search').getPlugin("repozer")
if type(obj).__name__ == 'Conference':
return plugin.getOptions()["indexConference"].getValue()
if type(obj).__name__ == 'Contribution':
return plugin.getOptions()["indexContribution"].getValue()
if type(obj).__name__ == 'LocalFile':
return plugin.getOptions()["indexMaterial"].getValue()
return False
示例6: getPluginTPlDir
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)))
示例7: isActive
def isActive(self):
"""
Wrapper around the original PluginsHolder method.
"""
ph = PluginsHolder()
stats = ph.getById('statistics')
k = self.getName().lower()
if not k in stats.getPlugins():
return False
else:
return stats.getPlugins().get(k).isActive()
示例8: isActive
def isActive(self):
"""
Wrapper around the original PluginsHolder method.
"""
ph = PluginsHolder()
search = ph.getById('search')
k = self.getId().lower()
if not k in search.getPlugins():
return False
else:
return search.getPlugins().get(k).isActive()
示例9: _process
def _process( self ):
if self._conf.isClosed():
p = conferences.WPConferenceModificationClosed( self, self._target )
return p.display()
else:
ph = PluginsHolder()
if ph.getPluginType('Collaboration').getOption("useHTTPS").getValue():
self._tohttps = True
if self._checkHttpsRedirect():
return ""
p = collaboration.WPConfModifCollaboration( self, self._conf)
return p.display()
示例10: RHAdminPluginsBase
class RHAdminPluginsBase(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)
self._pluginId = params.get("pluginId", None)
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")
示例11: chatroomIndexMigration
def chatroomIndexMigration(dbi, withRBDB, prevVersion):
"""
Migrating Chat Room index to new structure
"""
# The structure of the indexes is such that for each one self._data
# is a BTree and each node is referenced by the IndexBy___ designation,
# where ___ is the ID in question. Each node is then a TreeSet of
# ChatRoom or XMPPChatRoom objects originally orderded by ID, we need
# this to be ordered by title for effective searching / querying.
# The __cmp__ method has been altered to accommodate this new format,
# take each subnode, iterate through saving the current objects, clear the
# index and reinsert them - they will now be in the correct order.
from MaKaC.plugins.InstantMessaging.indexes import IndexByUser, IndexByConf, IndexByCRName, IndexByID
im_plugin = PluginsHolder().getPluginType('InstantMessaging')
if not im_plugin.isUsable():
print console.colored(' IM plugin not usable - jumping task', 'yellow')
return
try:
for idx in [IndexByUser(), IndexByConf(), IndexByCRName()]:
tmp_idx = defaultdict(list)
print console.colored(" * Index: " + str(idx), 'blue')
for key, node in idx._data.iteritems():
for leaf in node:
tmp_idx[key].append(leaf)
# reset index
idx._data.clear()
for accum, rooms in tmp_idx.iteritems():
for room in rooms:
# Specific handling as IndexByUser & IndexByConf have different
# arguements for tree insertion.
if isinstance(idx, IndexByUser) or isinstance(idx, IndexByConf):
idx.index(str(accum), room)
else:
idx.index(room)
print console.colored("\tAll indexes have now been re-indexed and committed to the DB.", 'green')
except:
dbi.abort()
print console.colored("Process failed, ended abruptly, changes not committed.", 'red')
raise
示例12: pluginOptionsRoomGUIDs
def pluginOptionsRoomGUIDs(dbi, withRBDB, prevVersion):
"""
Modifying Room GUIDs
"""
if not withRBDB:
return
ph = PluginsHolder()
for pluginName, roomsOpt in [('WebcastRequest', 'webcastCapableRooms'),
('RecordingRequest', 'recordingCapableRooms')]:
opt = ph.getPluginType('Collaboration').getPlugin(pluginName).getOption(roomsOpt)
newValue = []
for name in opt.getValue():
loc, name = name.split(':')
room = CrossLocationQueries.getRooms(location=loc, roomName=name)
if room:
newValue.append(str(room.guid))
opt.setValue(newValue)
示例13: changeVidyoRoomNames
def changeVidyoRoomNames(dbi, withRBDB, prevVersion):
"""
Changing Vidyo Room Names
"""
ph = PluginsHolder()
collaboration_pt = ph.getPluginType("Collaboration")
if not collaboration_pt.isActive() or not collaboration_pt.getPlugin("Vidyo").isActive():
return
i = 0
for booking in VidyoTools.getIndexByVidyoRoom().itervalues():
if hasattr(booking, '_originalConferenceId'):
roomName = booking.getBookingParamByName("roomName") + '_indico_' + booking._originalConferenceId
booking._bookingParams["roomName"] = roomName.decode("utf-8")
del booking._originalConferenceId
i += 1
if i % 10000 == 0:
dbi.commit()
dbi.commit()
示例14: _checkParams
def _checkParams(self, params):
RHAdminBase._checkParams(self, params)
self._pluginType = params.get("pluginType", None)
self._pluginId = params.get("pluginId", None)
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")
示例15: updatePluginSettingsNewRB
def updatePluginSettingsNewRB(dbi, prevVersion):
"""Migrate plugin settings to be compatible with the new RB module"""
ph = PluginsHolder()
# Custom attributes are now loercase-with-dashes internally
opt = ph.getPluginType('Collaboration').getPlugin('CERNMCU').getOption('H323_IP_att_name')
if opt.getValue() == 'H323 IP':
opt.setValue('h323-ip')
# Replace room GUIDs with plain room IDs
for plugin_name, rooms_opt in [('WebcastRequest', 'webcastCapableRooms'),
('RecordingRequest', 'recordingCapableRooms')]:
opt = ph.getPluginType('Collaboration').getPlugin(plugin_name).getOption(rooms_opt)
room_ids = []
for room_id in opt.getValue():
if isinstance(room_id, basestring):
room_id = int(room_id.split('|')[1].strip())
if Room.get(room_id):
room_ids.append(room_id)
opt.setValue(room_ids)
dbi.commit()