本文整理汇总了Python中MaKaC.common.externalOperationsManager.ExternalOperationsManager.execute方法的典型用法代码示例。如果您正苦于以下问题:Python ExternalOperationsManager.execute方法的具体用法?Python ExternalOperationsManager.execute怎么用?Python ExternalOperationsManager.execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.common.externalOperationsManager.ExternalOperationsManager
的用法示例。
在下文中一共展示了ExternalOperationsManager.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createChatroom
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def createChatroom(cls, obj, params):
room = params['room']
# we give this operation the name createSomething in the externaloperationsmanager
# we will execute the method performOperation in a chat room creation, which will send an email to all the requested users
# saying that a chat room was created. We pass the 2 mandatory arguments and finally the arguments required for performOperation
# (in this case, only one argument)
ExternalOperationsManager.execute(cls, "create_"+str(cls.__class__)+str(room.getId()), cls.performOperation, 'create', room.getConferences().values()[0], room, room)
示例2: _connect
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _connect(self, force=False):
self._checkStatus()
connectionStatus = self.connectionStatus()
if isinstance(connectionStatus, VidyoError):
return connectionStatus
confRoomIp = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="H323 IP")
confRoomPanoramaUser = VidyoTools.getLinkRoomAttribute(self.getLinkObject(), attName="VidyoPanorama ID")
if confRoomIp == "" and confRoomPanoramaUser == "":
return VidyoError("noValidConferenceRoom", "connect")
if connectionStatus.get("isConnected") == True:
if connectionStatus.get("roomName") == self.getBookingParamByName("roomName"):
return VidyoError("alreadyConnected", "connect",
_("It seems that the room has been already connected to the room, please refresh the page."))
if not force:
# if connect is not forced, give up
return VidyoError("alreadyConnected", "connect",
_("The room is already connected to some other endpoint. Please refresh the page."))
else:
# otherwise, replace whatever call is going on
ExternalOperationsManager.execute(
self, "disconnectRoom", VidyoOperations.disconnectRoom,
self, connectionStatus, confRoomIp, confRoomPanoramaUser)
retry = 15
connected = True
# wait for the current call to be disconnected
while retry:
connectionStatus = self.connectionStatus()
time.sleep(2)
retry -= 1
if connectionStatus.get("isConnected") == False:
connected = False
break
if connected:
return VidyoError("couldntStop", "connect",
_("It seems like we haven't managed to stop "
"the current call. Please refresh the page and try again."))
else:
# give it some time before trying to connect
time.sleep(5)
query = (getVidyoOptionValue("prefixConnect") + confRoomIp) if confRoomIp else confRoomPanoramaUser
result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId,
query)
if isinstance(result, VidyoError):
return result
return self
示例3: run
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def run(self):
logger = self.getLogger()
storage = getAvatarConferenceStorage()
keysToDelete = []
# Send the requests
for key, eventList in storage.iteritems():
for event in eventList:
logger.info("Processing: {}:{}".format(key, event))
if not event.get('request_sent', False): # only the ones that are not already sent
result = ExternalOperationsManager.execute(self,
'sendEventRequest{}{}'.format(key, event['eventType']),
self._sendEventRequest, key, event['eventType'],
event['avatar'], event['conference'])
if result is None:
logger.error("Request failed")
break
elif result.status_code != 200:
logger.error('Request unsuccessful({})\nPayload: {}\nResponse: {}'
.format(result.status_code, self.payload, result.content))
break
else:
logger.debug("Processed successfully")
event['request_sent'] = True
else:
keysToDelete.append(key)
self._clearAvatarConferenceStorage(keysToDelete)
示例4: _attach
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _attach(self):
""" Creates the Vidyo public room that will be associated to this CSBooking,
based on the booking params.
Returns None if success.
Returns a VidyoError if there is a problem.
"""
result = ExternalOperationsManager.execute(self, "attachRoom", VidyoOperations.attachRoom, self)
if isinstance(result, VidyoError):
return result
else:
self._roomId = str(result.roomID)
self._extension = str(result.extension)
self._url = str(result.RoomMode.roomURL)
self.setOwnerAccount(str(result.ownerName), updateAvatar = True)
recoveredDescription = VidyoTools.recoverVidyoDescription(result.description)
if recoveredDescription:
self._bookingParams["roomDescription"] = recoveredDescription
else:
self._warning = "invalidDescription"
if bool(result.RoomMode.hasPIN):
self.setPin(str(result.RoomMode.roomPIN))
else:
self.setPin("")
if bool(result.RoomMode.hasModeratorPIN):
self.setModeratorPin(str(result.RoomMode.moderatorPIN))
else:
self.setModeratorPin("")
self._bookingParams["autoMute"] = self._getAutomute()
self.setBookingOK()
VidyoTools.getEventEndDateIndex().indexBooking(self)
VidyoTools.getIndexByVidyoRoom().indexBooking(self)
示例5: _setModeratorPIN
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _setModeratorPIN(self):
result = ExternalOperationsManager.execute(self, "setModeratorPIN", VidyoOperations.setModeratorPIN, self)
if isinstance(result, VidyoError):
if result.getErrorType() == 'unknownRoom':
self.setBookingNotPresent()
raise result
示例6: _delete
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _delete(self, fromDeleteOld = False, maxDate = None):
""" Deletes the Vidyo Public room associated to this CSBooking, based on the roomId
Returns None if success.
If trying to delete a non existing room, there will be a message in self._warning
so that it is caught by Main.js's postDelete function.
"""
if self.isCreated():
deleteRemote = unindexBooking = False
if self.hasToBeDeleted(fromDeleteOld, maxDate):
self.setCreated(False)
deleteRemote = unindexBooking = True
elif not fromDeleteOld:
unindexBooking = True
if deleteRemote:
result = ExternalOperationsManager.execute(self, "deleteRoom", VidyoOperations.deleteRoom, self, self._roomId)
if isinstance(result, VidyoError):
if result.getErrorType() == "unknownRoom" and result.getOperation() == "delete":
if not fromDeleteOld:
self._warning = "cannotDeleteNonExistant"
else:
return result
if unindexBooking:
VidyoTools.getEventEndDateIndex().unindexBooking(self)
VidyoTools.getIndexByVidyoRoom().unindexBooking(self)
示例7: _automute_op
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _automute_op(self, op):
op_name = "{0}Automute".format(op)
result = ExternalOperationsManager.execute(self, op_name, getattr(VidyoOperations, op_name), self)
if isinstance(result, VidyoError):
if result.getErrorType() == 'unknownRoom':
self.setBookingNotPresent()
raise automute_result
示例8: _performCall
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _performCall(self, default=None):
"""
Acts as an entry point for all derivative classes to use the
ExternalOperationsManager for performing remote calls.
"""
return ExternalOperationsManager.execute(self,
"performCall",
self._performExternalCall,
default)
示例9: _connect
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _connect(self):
self._checkStatus()
if self.canBeConnected():
confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject())
if confRoomIp == "":
return VidyoError("noValidConferenceRoom", "connect")
prefixConnect = getVidyoOptionValue("prefixConnect")
result = ExternalOperationsManager.execute(self, "connectRoom", VidyoOperations.connectRoom, self, self._roomId, prefixConnect + confRoomIp)
if isinstance(result, VidyoError):
return result
return self
示例10: _delete
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _delete(self):
"""
This function will delete the specified video booking from the WebEx server
"""
try:
result = ExternalOperationsManager.execute(self, "deleteBooking", WebExOperations.deleteBooking, self)
if isinstance(result, WebExError):
return result
except Exception,e:
Logger.get('WebEx').error(
"""Could not delete booking with id %s of event with id %s, exception: %s""" %
(self.getId(), self.getConference().getId(), str(e)))
return WebExError( errorType = None, userMessage = _("""There was an error communicating with the WebEx server. The request was unsuccessful. Error information: %s""" % str(e)) )
示例11: _create
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _create(self):
""" Creates a booking in the WebEx server if all conditions are met.
"""
params = self.getBookingParams()
self.setAccessPassword( params['accessPassword'] )
self._duration = findDuration( self.getStartDate(), self.getEndDate() )
try:
result = ExternalOperationsManager.execute(self, "createBooking", WebExOperations.createBooking, self)
except Exception,e:
Logger.get('WebEx').error(
"""Could not create booking with id %s of event with id %s, exception: %s""" %
(self.getId(), self.getConference().getId(), str(e)))
return WebExError( errorType = None, userMessage = _("""There was an error communicating with the WebEx server. The request was unsuccessful. Error information: %s""" % str(e)) )
示例12: _disconnect
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _disconnect(self):
self._checkStatus()
confRoomIp = VidyoTools.getLinkRoomIp(self.getLinkObject())
if confRoomIp == "":
return VidyoError("noValidConferenceRoom", "disconnect")
connectionStatus = self.connectionStatus()
if isinstance(connectionStatus, VidyoError):
return connectionStatus
if not connectionStatus.get("isConnected"):
return VidyoError("alreadyDisconnected", "disconnect", _("It seems that the room has been already disconnected, please refresh the page"))
result = ExternalOperationsManager.execute(self, "disconnectRoom", VidyoOperations.disconnectRoom, self, confRoomIp, connectionStatus.get("service"))
if isinstance(result, VidyoError):
return result
return self
示例13: _modify
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _modify(self, oldBookingParams):
""" Modifies the Vidyo public room in the remote system
"""
result = ExternalOperationsManager.execute(self, "modifyRoom", VidyoOperations.modifyRoom, self, oldBookingParams)
if isinstance(result, VidyoError):
if result.getErrorType() == 'unknownRoom':
self.setBookingNotPresent()
return result
else:
self._extension = str(result.extension)
self._url = str(result.RoomMode.roomURL)
self.setOwnerAccount(str(result.ownerName))
self.setBookingOK()
if oldBookingParams["owner"]["id"] != self.getOwnerObject().getId():
self._sendNotificationToOldNewOwner(oldBookingParams["owner"])
示例14: _create
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def _create(self):
""" Creates the Vidyo public room that will be associated to this CSBooking,
based on the booking params.
After creation, it also retrieves some more information from the newly created room.
Returns None if success.
Returns a VidyoError if there is a problem, such as the name being duplicated.
"""
result = ExternalOperationsManager.execute(self, "createRoom", VidyoOperations.createRoom, self)
if isinstance(result, VidyoError):
return result
else:
# Link to a Session or Contribution if requested
self._roomId = str(result.roomID) # we need to convert values read to str or there will be a ZODB exception
self._extension = str(result.extension)
self._url = str(result.RoomMode.roomURL)
self.setOwnerAccount(str(result.ownerName))
self.setBookingOK()
VidyoTools.getEventEndDateIndex().indexBooking(self)
示例15: run
# 需要导入模块: from MaKaC.common.externalOperationsManager import ExternalOperationsManager [as 别名]
# 或者: from MaKaC.common.externalOperationsManager.ExternalOperationsManager import execute [as 别名]
def run(self):
logger = self.getLogger()
storage = getAvatarConferenceStorage()
keysToDelete = []
# Send the requests
for key, eventList in storage.iteritems():
for event in eventList:
logger.info("processing: %s:%s" % (key, event))
if not event.get('request_sent', False): # only the ones that are not already sent
result = ExternalOperationsManager.execute(self, 'sendEventRequest' + key + event['eventType'], self._sendEventRequest, key, event['eventType'], event['avatar'], event['conference'])
if result != 200:
logger.debug("POST failed")
break
else:
logger.debug("processing successful")
event['request_sent'] = True
else:
keysToDelete.append(key)
self._clearAvatarConferenceStorage(keysToDelete)