Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def modifyParticipantDisplayName(self, participantName, participantType, participantProtocol, newDisplayName):
""" Modifies the display name of a participant
returns: True if successful, a CERNMCUError if there is a problem in some cases, raises an Exception in others
"""
try:
mcu = MCU.getInstance()
params = MCUParticipantCommonParams(
conferenceName = self._bookingParams["name"],
participantName = participantName,
participantType = participantType,
participantProtocol = participantProtocol,
displayNameOverrideValue = newDisplayName)
Logger.get('CERNMCU').info(
"Evt: %s, booking: %s, calling participant.modify with params: %s" %
(self._conf.getId(), self.getId(), str(paramsForLog(params))))
answer = unicode_struct_to_utf8(mcu.participant.modify(params))
Logger.get('CERNMCU').info(
"Evt:%s, booking:%s, calling participant.modify. Got answer: %s" %
(self._conf.getId(), self.getId(), str(answer)))
return True
except Fault, e:
Logger.get('CERNMCU').warning("""Evt:%s, calling participant.modify. Got error: %s""" % (self._conf.getId(), str(e)))
fault = self.handleFault('modifyParticipant', e)
fault.setInfo(participantName)
return fault
def infoChanged(cls, obj):
#Update Speaker Wrapper only if obj is a Conference
if isinstance(obj, Conference) or isinstance(obj, Contribution):
bookingManager = Catalog.getIdx("cs_bookingmanager_conference").get(obj.getConference().getId())
if not bookingManager:
return
try:
bookingManager.notifyInfoChange()
except Exception, e:
Logger.get('PluginNotifier').error("Exception while trying to access the info changes " + str(e))
f.setFileName("EAForm-{0}{1}".format(self.spkUniqueId, extension))
f.setFilePath(self.filePath)
f.setId(self.spkUniqueId)
# Update status for speaker wrapper
manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId())
spkWrapper = manager.getSpeakerWrapperByUniqueId(self.spkUniqueId)
repo = self._conf._getRepository()
f.setOwner(spkWrapper)
f.archive(repo)
# if no error, update the speaker wrapper...
spkWrapper.setStatus(SpeakerStatusEnum.FROMFILE) #change status
spkWrapper.setLocalFile(f) # set path to file
spkWrapper.triggerNotification() # trigger notification task
except:
Logger.get('file_upload').exception("Error uploading file")
raise MaKaCError("Unexpected error while uploading file")
def unindex(self, entryId):
intId = self.getInteger(entryId)
if intId != None:
self.removeString(entryId)
self._textIdx.unindex_doc(intId)
else:
Logger.get('indexes.text').error("No such entry '%s'" % entryId)
'-interaction', 'nonstopmode',
'-output-directory', self.source_dir,
os.path.relpath(source_file, self.source_dir)]
try:
# set config which limits location of input/output files
subprocess.check_call(
pdflatex_cmd,
stdout=log_file,
cwd=self.source_dir,
env=dict(os.environ, TEXMFCNF='{}:'.format(os.path.dirname(__file__)))
)
Logger.get('pdflatex').debug("PDF created successfully!")
except subprocess.CalledProcessError:
Logger.get('pdflatex').debug('PDF creation possibly failed (non-zero exit code)!')
# Only fail if we are in strict mode
if config.STRICT_LATEX:
# flush log, go to beginning and read it
if log_file:
log_file.flush()
raise
# mark it as created, and stop the cycle
self._created = True
break
enumerateID = answer.get("enumerateID", None)
keepAsking = enumerateID is not None
if not found:
self._created = False
self._p_changed = 1
except Fault, e:
Logger.get('CERNMCU').warning("""Evt:%s, booking:%s, calling participants.enumerate. Got error: %s""" % (self._conf.getId(), self.getId(), str(e)))
raise
except socket.error, e:
handleSocketError(e)
def addParticipant(self, participant):
""" Adds a participant to the MCU conference represented by this booking.
participant: a Participant object
returns: True if successful, a CERNMCUError if there is a problem in some cases, raises an Exception in others
"""
try:
mcu = MCU.getInstance()
params = MCUParticipantCommonParams(conferenceName = self._bookingParams["name"],
participantName = participant.getParticipantName(),
displayNameOverrideValue = participant.getDisplayName(),
address = participant.getIp(),
participantProtocol = participant.getParticipantProtocol()
)
Logger.get('CERNMCU').info("""Evt:%s, booking:%s, calling participant.add with params: %s""" % (self._conf.getId(), self.getId(), str(paramsForLog(params))))
answer = unicode_struct_to_utf8(mcu.participant.add(params))
Logger.get('CERNMCU').info("""Evt:%s, booking:%s, calling participant.add. Got answer: %s""" % (self._conf.getId(), self.getId(), str(answer)))
if self._numberOfConnectedParticipants > 0:
#we have to connect the new participant
self._connectParticipant(participant)
return True
except Fault, e:
Logger.get('CERNMCU').warning("""Evt:%s, calling participant.add. Got error: %s""" % (self._conf.getId(), str(e)))
fault = self.handleFault('add', e)
fault.setInfo(participant.getIp())
return fault
%(tz_id)s
%(date)s
""" % ( { "username" : params['webExUser'], "password" : self.getWebExPass(), "siteID" : getWebExOptionValueByName("WESiteID"), "partnerID" : getWebExOptionValueByName("WEPartnerID"), "tz_id":tz_id, "date":the_date } )
response_xml = sendXMLRequest( request_xml )
dom = xml.dom.minidom.parseString( response_xml )
offset = dom.getElementsByTagName( "ns1:gmtOffset" )[0].firstChild.toxml('utf-8')
try:
return int(offset)
except:
Logger.get('WebEx').debug( "Eror requesting time zone offset from WebEx:\n\n%s" % ( response_xml ) )
return None
def notifyLocationChange(self):
self.unindex_instances()
self.index_instances()
if MailTools.needToSendEmails('RecordingRequest'):
try:
notification = RequestRelocatedNotification(self)
GenericMailer.sendAndLog(notification, self.getConference(),
self.getPlugin().getName())
except Exception,e:
Logger.get('RecReq').exception(
"""Could not send RequestRelocatedNotification for request with id %s of event %s, exception: %s""" % (self._id, self.getConference().getId(), str(e)))
return RecordingRequestError('edit', e)
def _process(self):
if not self.plugin.can_manage_vc_rooms(session.user, self.event):
flash(_('You are not allowed to refresh {plugin_name} rooms for this event.').format(
plugin_name=self.plugin.friendly_name), 'error')
return redirect(url_for('.manage_vc_rooms', self.event))
Logger.get('modules.vc').info("Refreshing VC room %r from event %r", self.vc_room, self.event)
try:
self.plugin.refresh_room(self.vc_room, self.event)
except VCRoomNotFoundError as err:
Logger.get('modules.vc').warning("VC room %r not found. Setting it as deleted.", self.vc_room)
self.vc_room.status = VCRoomStatus.deleted
flash(err.message, 'error')
return redirect(url_for('.manage_vc_rooms', self.event))
flash(_("{plugin_name} room '{room.name}' refreshed").format(
plugin_name=self.plugin.friendly_name, room=self.vc_room), 'success')
return redirect(url_for('.manage_vc_rooms', self.event))