本文整理汇总了Python中MaKaC.plugins.Collaboration.Vidyo.api.api.AdminApi.updateRoom方法的典型用法代码示例。如果您正苦于以下问题:Python AdminApi.updateRoom方法的具体用法?Python AdminApi.updateRoom怎么用?Python AdminApi.updateRoom使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.plugins.Collaboration.Vidyo.api.api.AdminApi
的用法示例。
在下文中一共展示了AdminApi.updateRoom方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: modifyRoom
# 需要导入模块: from MaKaC.plugins.Collaboration.Vidyo.api.api import AdminApi [as 别名]
# 或者: from MaKaC.plugins.Collaboration.Vidyo.api.api.AdminApi import updateRoom [as 别名]
def modifyRoom(cls, booking, oldBookingParams):
# we extract the different parameters
# We set the original conference id because the bookings can belong to more than one conference and being cloned
# and it is used for the long name, we need to keep always the same confId
confId = booking.getConference().getId()
bookingId = booking.getId()
roomId = booking.getRoomId()
roomName = booking.getBookingParamByName("roomName")
description = booking.getBookingParamByName("roomDescription")
newOwner = booking.getOwnerObject() #an avatar object
ownerAccountName = booking.getOwnerAccount() #a str
oldOwner = oldBookingParams["owner"] #an IAvatarFossil fossil
pin = booking.getPin()
moderatorPin = booking.getModeratorPin()
#we obtain the unicode object with the proper format for the room name
roomNameForVidyo = VidyoTools.roomNameForVidyo(roomName)
if isinstance(roomNameForVidyo, VidyoError):
return roomNameForVidyo
#we turn the description into a unicode object
description = VidyoTools.descriptionForVidyo(description)
if isinstance(description, VidyoError):
return description
#(the extension will not change)
#we check if the owner has changed. If not, we reuse the same accountName
useOldAccountName = True
possibleLogins = []
if newOwner.getId() != oldOwner["id"]:
useOldAccountName = False
#we produce the list of possible account names. We will loop through them to attempt to create the room
possibleLogins = VidyoTools.getAvatarLoginList(newOwner)
if not possibleLogins:
raise CollaborationException(_("The moderator has no login information"))
# We check the moderator PIN is a 3-10 digit number
if moderatorPin and (not moderatorPin.isdigit() or len(moderatorPin) < 3 or len(moderatorPin) > 10):
return VidyoError("PINLength", "modify")
roomModified = False
loginToUse = 0
while not roomModified and (useOldAccountName or loginToUse < len(possibleLogins)):
if not useOldAccountName:
ownerAccountName = possibleLogins[loginToUse]
newRoom = SOAPObjectFactory.createRoom(roomNameForVidyo, description, ownerAccountName, booking.getExtension(), pin, moderatorPin)
try:
AdminApi.updateRoom(roomId, newRoom)
roomModified = True
except WebFault, e:
faultString = e.fault.faultstring
if faultString.startswith('Room not exist for roomID'):
return VidyoError("unknownRoom", "modify")
elif faultString.startswith('Room exist for name'):
return VidyoError("duplicated", "modify")
elif faultString.startswith('Member not found for ownerName'):
if useOldAccountName:
#maybe the user was deleted between the time the room was created and now
return VidyoError("badOwner", "modify")
else:
loginToUse = loginToUse + 1
elif faultString.startswith('PIN should be a 3-10 digit number'):
return VidyoError("PINLength", "modify")
else:
Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's updateRoom operation got WebFault: %s""" %
(confId, bookingId, e.fault.faultstring))
raise