def _checkParams(self): ConferenceModifBase._checkParams(self) self._pm = ParameterManager(self._params) self.uniqueIdList = self._pm.extract("uniqueIdList", list, False, []) fromMail = self._pm.extract("from", dict, False, {}) self.fromEmail = fromMail['email'] self.fromName = fromMail['name'] self.content = self._pm.extract("content", str, False, "") p_cc = self._pm.extract("cc", str, True, "").strip() self.cc = setValidEmailSeparators(p_cc).split(',') if p_cc else [] self.emailToList = [] manager = Catalog.getIdx("cs_bookingmanager_conference").get(self._conf.getId()) for uniqueId in self.uniqueIdList: spk = manager.getSpeakerWrapperByUniqueId(uniqueId) if spk.getStatus() not in [SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE]: self.emailToList.extend(manager.getSpeakerEmailByUniqueId(uniqueId, self._aw.getUser()))
def _handleSet(self): self._supportInfo = self._target.getSupportInfo() caption = self._value.get("caption", "") email = self._value.get("email", "") phone = self._value.get("telephone", "") if caption == "": raise ServiceError("ERR-E2", "The caption cannot be empty") self._supportInfo.setCaption(caption) # handling the case of a list of emails with separators different than "," email = setValidEmailSeparators(email) if validMail(email) or email == "": self._supportInfo.setEmail(email) else: raise ServiceError("ERR-E0", "E-mail address %s is not valid!" % self._value) self._supportInfo.setTelephone(phone)
def _handleSet(self): self._supportInfo = self._target.getSupportInfo() caption = self._value.get("caption", "") email = self._value.get("email", "") phone = self._value.get("telephone", "") if caption == "": raise ServiceError("ERR-E2", "The caption cannot be empty") self._supportInfo.setCaption(caption) # handling the case of a list of emails with separators different than "," email = setValidEmailSeparators(email) if validMail(email) or email == "": self._supportInfo.setEmail(email) else: raise ServiceError('ERR-E0', 'E-mail address %s is not valid!' % self._value) self._supportInfo.setTelephone(phone)
def _checkParams(self): ConferenceModifBase._checkParams(self) self._pm = ParameterManager(self._params) self.uniqueIdList = self._pm.extract("uniqueIdList", list, False, []) fromMail = self._pm.extract("from", dict, False, {}) self.fromEmail = fromMail['email'] self.fromName = fromMail['name'] self.content = self._pm.extract("content", str, False, "") p_cc = self._pm.extract("cc", str, True, "").strip() self.cc = setValidEmailSeparators(p_cc).split(',') if p_cc else [] self.emailToList = [] manager = self._conf.getCSBookingManager() for uniqueId in self.uniqueIdList: spk = manager.getSpeakerWrapperByUniqueId(uniqueId) if spk.getStatus() not in [ SpeakerStatusEnum.SIGNED, SpeakerStatusEnum.FROMFILE ]: self.emailToList.extend( manager.getSpeakerEmailByUniqueId(uniqueId, self._aw.getUser()))
class UtilsConference: @staticmethod def get_start_dt(params): tz = params['Timezone'] try: return timezone(tz).localize( datetime(int(params['sYear']), int(params['sMonth']), int(params['sDay']), int(params['sHour']), int(params['sMinute']))) except ValueError as e: raise FormValuesError( 'The start date you have entered is not correct: {}'.format(e), 'Event') @staticmethod def get_end_dt(params, start_dt): tz = params['Timezone'] if params.get('duration'): end_dt = start_dt + timedelta(minutes=params['duration']) else: try: end_dt = timezone(tz).localize( datetime(int(params['eYear']), int(params['eMonth']), int(params['eDay']), int(params['eHour']), int(params['eMinute']))) except ValueError as e: raise FormValuesError( 'The end date you have entered is not correct: {}'.format( e), 'Event') return end_dt @staticmethod def get_location_data(params): location_data = json.loads(params['location_data']) if location_data.get('room_id'): location_data['room'] = Room.get_one(location_data['room_id']) if location_data.get('venue_id'): location_data['venue'] = Location.get_one( location_data['venue_id']) return location_data @classmethod def setValues(cls, c, confData, notify=False): c.setTitle(confData["title"]) c.setDescription(confData["description"]) c.setOrgText(confData.get("orgText", "")) c.setComments(confData.get("comments", "")) c.as_event.keywords = confData["keywords"] c.setChairmanText(confData.get("chairText", "")) if "shortURLTag" in confData.keys(): tag = confData["shortURLTag"].strip() if tag: try: UtilsConference.validateShortURL(tag, c) except ValueError, e: raise FormValuesError(e.message) if c.getUrlTag() != tag: mapper = ShortURLMapper() mapper.remove(c) c.setUrlTag(tag) if tag: mapper.add(tag, c) c.setContactInfo(confData.get("contactInfo", "")) ################################# # Fermi timezone awareness # ################################# c.setTimezone(confData["Timezone"]) sDate = cls.get_start_dt(confData) eDate = cls.get_end_dt(confData, sDate) moveEntries = int(confData.get("move", 0)) with track_time_changes(): c.setDates(sDate.astimezone(timezone('UTC')), eDate.astimezone(timezone('UTC')), moveEntries=moveEntries) ################################# # Fermi timezone awareness(end) # ################################# old_location_data = c.as_event.location_data location_data = cls.get_location_data(confData) update_event(c.as_event, {'location_data': location_data}) if old_location_data != location_data: signals.event.data_changed.send(c, attr='location', old=old_location_data, new=location_data) emailstr = setValidEmailSeparators(confData.get("supportEmail", "")) if (emailstr != "") and not validMail(emailstr): raise FormValuesError( "One of the emails specified or one of the separators is invalid" ) c.getSupportInfo().setEmail(emailstr) c.getSupportInfo().setCaption(confData.get("supportCaption", "Support")) # TODO: remove TODO once visibility has been updated if c.getVisibility() != confData.get( "visibility", 999) and confData.get('visibility') != 'TODO': c.setVisibility(confData.get("visibility", 999)) theme = confData.get('defaultStyle', '') new_type = EventType.legacy_map[confData[ 'eventType']] if 'eventType' in confData else c.as_event.type_ if new_type != c.as_event.type_: c.as_event.type_ = new_type elif not theme or theme == theme_settings.defaults.get( new_type.legacy_name): # if it's the default theme or nothing was set (does this ever happen?!), we don't store it layout_settings.delete(c, 'timetable_theme') else: # set the new theme layout_settings.set(c, 'timetable_theme', theme)
c.setRoom( None ) else: r = c.getRoom() if not r: r = conference.CustomRoom() c.setRoom( r ) if r.getName() != newRoom: r.setName(newRoom) r.retrieveFullName(newLocation) changed = True if changed: c._notify('placeChanged') emailstr = setValidEmailSeparators(confData.get("supportEmail", "")) if (emailstr != "") and not validMail(emailstr): raise FormValuesError("One of the emails specified or one of the separators is invalid") c.getSupportInfo().setEmail(emailstr) c.getSupportInfo().setCaption(confData.get("supportCaption","Support")) displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(c).setDefaultStyle(confData.get("defaultStyle","")) if c.getVisibility() != confData.get("visibility",999): c.setVisibility( confData.get("visibility",999) ) curType = c.getType() newType = confData.get("eventType","") if newType != "" and newType != curType: wr = webFactoryRegistry.WebFactoryRegistry() factory = wr.getFactoryById(newType) wr.registerFactory(c,factory)
r.retrieveFullName(newLocation) changed = True if changed: new_data = { 'location': l.name if l else '', 'address': l.address if l else '', 'room': r.name if r else '' } if old_data != new_data: signals.event.data_changed.send(c, attr='location', old=old_data, new=new_data) emailstr = setValidEmailSeparators(confData.get("supportEmail", "")) if (emailstr != "") and not validMail(emailstr): raise FormValuesError( "One of the emails specified or one of the separators is invalid" ) c.getSupportInfo().setEmail(emailstr) c.getSupportInfo().setCaption(confData.get("supportCaption", "Support")) displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(c).setDefaultStyle( confData.get("defaultStyle", "")) if c.getVisibility() != confData.get("visibility", 999): c.setVisibility(confData.get("visibility", 999)) curType = c.getType() newType = confData.get("eventType", "")