def _checkParams(self): UserPersonalDataBase._checkParams(self) if (self._dataType == "surName" or self._dataType == "name" or self._dataType == "organisation"): self._value = self._pm.extract("value", pType=str, allowEmpty=False) elif self._dataType == "email": self._value = self._pm.extract("value", pType=str, allowEmpty=False) if not validMail(self._value): raise ServiceAccessError(_("The email address is not valid")) elif self._dataType == "secondaryEmails": self._value = self._pm.extract("value", pType=str, allowEmpty=True) if self._value and not validMail(self._value): raise ServiceAccessError(_("The email address is not valid. Please, review it.")) else: self._value = self._pm.extract("value", pType=str, allowEmpty=True)
def testMultipleValidEmails(self): emails = [ ' [email protected]; [email protected] , [email protected] ' ] for email in emails: self.assertEqual(utils.validMail(email), is_valid_mail(email))
def _checkParams(self, params): RHCategModifBase._checkParams(self, params) self._emailList = params.get("notifyCreationList", "") if self._emailList.strip() != "" and not validMail(self._emailList): raise FormValuesError( _("The email list contains invalid e-mail addresses or invalid separator" ))
def _process(self): canManageRegistration = self._conf.canManageRegistration(self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams(params, 'email') if email is None: raise FormValuesError(_("An email address has to be set in order to make the registration in the event.")) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) # Check if the email matches an existing user user = get_user_by_email(email) avatar = user.as_avatar if user else None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): flash(_("Your registration couldn't be recorded."), 'error') return redirect(url_for('event.confRegistrationFormDisplay', self._conf)) if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email) else: if avatar.isRegisteredInConf(self._conf) or self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email) else: raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email) rp = registration.Registrant() self._conf.addRegistrant(rp, avatar) rp.setValues(self._getRequestParams(), avatar) if avatar is not None: rp.setAvatar(avatar) notify_registration_confirmation(self._conf, rp) self._conf.log(EventLogRealm.management if self.is_manager else EventLogRealm.participants, EventLogKind.positive, u'Registration', u'User registered: {}'.format(to_unicode(rp.getFullName(title=False, firstNameFirst=True))), session.user, data={u'Indico user': u'{} ({})'.format(user.full_name, user.id) if user else u'None'}) if self.is_manager: self._redirect(RHRegistrantListModif._uh.getURL(self._conf)) else: params = {} if not rp.doPay() or not payment_event_settings.get(self._conf, 'enabled'): flash(_(u"Your registration has been recorded successfully."), 'success') if not session.user or session.user != user: params.update(rp.getLocator(), **{'authkey': rp.getRandomId()}) else: params.update(self._conf.getLocator()) return redirect(url_for('event.confRegistrationFormDisplay', **params))
def _process(self): canManageRegistration = self._conf.canManageRegistration(self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams(params, 'email') if email is None: raise FormValuesError(_("An email address has to be set in order to make the registration in the event.")) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email) else: if user.isRegisteredInConf(self._conf) or self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email) else: raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email) rp = registration.Registrant() self._conf.addRegistrant(rp, user) rp.setValues(self._getRequestParams(), user) if user is not None: user.addRegistrant(rp) rp.setAvatar(user) # This creates the email to the new registrant and SENDS the email to the organizers if necessary... WTF. email = self._regForm.getNotification().createEmailNewRegistrant(self._regForm, rp) if self._regForm.isSendRegEmail() and rp.getEmail().strip(): modEticket = self._conf.getRegistrationForm().getETicket() if modEticket.isEnabled() and modEticket.isAttachedToEmail(): attachment = { 'name': "{0}-Ticket.pdf".format(self._target.getTitle()), 'binary': TicketToPDF(self._target, rp).getPDFBin(), } email["attachments"] = [attachment] GenericMailer.send(email) if canManageRegistration and user != self._getUser(): self._redirect(RHRegistrantListModif._uh.getURL(self._conf)) else: self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
def testNotAllowedMultipleInValidEmails(self): emails = [ ' x$y@@; [email protected] ; [email protected]' ] for email in emails: self.assertEqual(utils.validMail(email, allowMultiple=False), is_valid_mail(email, multi=False))
def testMutlipleInvalidEmails(self): emails = [ ' x$y@@; [email protected] ; [email protected]' ] for email in emails: print is_valid_mail(email) self.assertEqual(utils.validMail(email), is_valid_mail(email))
def _process(self): canManageRegistration = self._conf.canManageRegistration(self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams(params, "email") if email is None: raise FormValuesError(_("An email address has to be set in order to make the registration in the event.")) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError('There is already a user with the email "%s". Please choose another one' % email) else: if user.isRegisteredInConf(self._conf): self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf)) return if self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError( 'There is already a user with the email "%s". Please choose another one' % email ) else: raise FormValuesError( 'You have already registered with the email address "%s". If you need to modify your registration, please contact the managers of the conference.' % email ) rp = registration.Registrant() self._conf.addRegistrant(rp) rp.setValues(self._getRequestParams(), user) rp.setSessionBillingEnabled(self._regForm.getSessionsForm().getType() != "2priorities") if user is not None: user.addRegistrant(rp) rp.setAvatar(user) # avoid multiple sending in case of db conflict email = self._regForm.getNotification().createEmailNewRegistrant(self._regForm, rp) if email: GenericMailer.send(email) if not canManageRegistration: self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp)) else: self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
def _process(self): canManageRegistration = self._conf.canManageRegistration(self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams(params, 'email') if email is None: raise FormValuesError(_("An email address has to be set in order to make the registration in the event.")) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): flash(_("Your registration couldn't be recorded."), 'error') return redirect(url_for('event.confRegistrationFormDisplay', self._conf)) if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email) else: if user.isRegisteredInConf(self._conf) or self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError("There is already a user with the email \"%s\". Please choose another one" % email) else: raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email) rp = registration.Registrant() self._conf.addRegistrant(rp, user) rp.setValues(self._getRequestParams(), user) if user is not None: user.addRegistrant(rp) rp.setAvatar(user) notify_registration_confirmation(self._conf, rp) if canManageRegistration and user != self._getUser(): self._redirect(RHRegistrantListModif._uh.getURL(self._conf)) else: params = {} if not rp.doPay() or not payment_event_settings.get(self._conf, 'enabled'): flash(_(u"Your registration has been recorded successfully."), 'success') if not session.avatar: params.update(rp.getLocator(), **{'authkey': rp.getRandomId()}) else: params.update(self._conf.getLocator()) return redirect(url_for('event.confRegistrationFormDisplay', **params))
def testOneInvalidEmail(self): emails = [ 'atom@cern', 'higgs#[email protected]', 'Abc.example.com', 'A@b@[email protected]', 'a"b(c)d,e:f;g<h>i[j\k][email protected]', 'just"not"*****@*****.**', 'this is"not\[email protected]', 'this\ still\"not\\[email protected]', '[email protected]' ] for email in emails: # self.assertFalse(is_valid_mail(email)) self.assertEqual(utils.validMail(email), is_valid_mail(email))
def _checkParams(self): UserPersonalDataBase._checkParams(self) if (self._dataType == "surName" or self._dataType == "name" or self._dataType == "organisation"): self._value = self._pm.extract("value", pType=str, allowEmpty=False) elif self._dataType == "email": self._value = self._pm.extract("value", pType=str, allowEmpty=False) if not validMail(self._value): raise ServiceAccessError(_("The email address is not valid")) elif self._dataType == "secondaryEmails": self._value = self._pm.extract("value", pType=str, allowEmpty=True) if self._value and not validMail(self._value): raise ServiceAccessError( _("The email address is not valid. Please, review it.")) else: self._value = self._pm.extract("value", pType=str, allowEmpty=True)
def _process( self ): canManageRegistration = self._conf.canManageRegistration(self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive( self, self._conf ) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams(params, 'email') if email is None: raise FormValuesError(_("An email address has to be set in order to make the registration in the event.")) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect(urlHandlers.UHConfRegistrationFormDisplay.getURL(self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%email) else: if user.isRegisteredInConf(self._conf): self._redirect(urlHandlers.UHConfRegistrationForm.getURL(self._conf)) return if self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError("There is already a user with the email \"%s\". Please choose another one"%email) else: raise FormValuesError("You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference."%email) rp = registration.Registrant() self._conf.addRegistrant(rp) rp.setValues(self._getRequestParams(), user) rp.setSessionBillingEnabled(self._regForm.getSessionsForm().getType() != "2priorities") if user is not None: user.addRegistrant(rp) rp.setAvatar(user) # avoid multiple sending in case of db conflict email = self._regForm.getNotification().createEmailNewRegistrant(self._regForm, rp) if email: GenericMailer.send(email) if not canManageRegistration: self._redirect(urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp)) else: self._redirect(RHRegistrantListModif._uh.getURL(self._conf))
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 testOneValidEmail(self): emails = [ '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', 'user@[IPv6:2001:db8:1ff::a0b:dbd0]', '"much.more unusual"@example.com', '"*****@*****.**"@example.com', '"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com', 'postbox@com', 'admin@mailserver1', "!#$%&'*+-/=?^_`{}|[email protected]", """()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org""", '" "@example.org', 'üñîçøðé@example.com', 'üñîçøðé@üñîçøðé.com' ] for email in emails: self.assertEqual(utils.validMail(email), is_valid_mail(email))
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)
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)
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) dispMgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(c) styleMgr = info.HelperMaKaCInfo.getMaKaCInfoInstance().getStyleManager()
def _checkParams(self, params): RHCategModifBase._checkParams(self, params) self._emailList = params.get("notifyCreationList","") if self._emailList.strip() != "" and not validMail(self._emailList): raise FormValuesError(_("The email list contains invalid e-mail addresses or invalid separator"))
def _handleSet(self): if validMail(self._value) or self._value == '': self._target.setSupportEmail(self._value) else: raise ServiceError('ERR-E0', 'E-mail address %s is not valid!' % self._value)
def _confirm_email_address(self, email, data_type): email = email.strip().lower() if not validMail(email): raise NoReportError(_("Invalid email address: {0}").format(email)) # Prevent adding the primary email as a secondary email if data_type == 'secondaryEmails' and email == self._avatar.getEmail(): raise NoReportError(_("{0} is already the primary email address " "and cannot be used as a secondary email address.").format(email)) # When setting a secondary email as primary, set it automatically and # re-index the user's emails without sending a confirmation email # (We assume the secondary emails are valid) if data_type == 'email' and email in self._avatar.getSecondaryEmails(): self._avatar.removeSecondaryEmail(email) self._avatar.setEmail(email, reindex=True) return False existing = AvatarHolder().match({'email': email}, searchInAuthenticators=False) if existing: if any(av for av in existing if av != self._avatar): raise NoReportError(_("The email address {0} is already used by another user.").format(email)) else: # The email is already set correctly for the user: Do nothing return False # New email address token_storage = GenericCache('confirm-email') data = {'email': email, 'data_type': data_type, 'uid': self._avatar.getId()} token = str(uuid.uuid4()) while token_storage.get(token): token = str(uuid.uuid4()) token_storage.set(token, data, 24 * 3600) url = url_for('user.confirm_email', token=token, _external=True, _secure=True) if data_type == 'email': body_format = _( "Dear {0},\n" "You requested to change your account's primary email address.\n" "Please open the link below within 24 hours to confirm and activate this email address:\n" "\n{1}\n\n" "--\n" "Indico" ) else: body_format = _( "Dear {0},\n" "You added this email address to your account's secondary emails list.\n" "Please open the link below within 24 hours to confirm and activate this email address:\n" "\n{1}\n\n" "--\n" "Indico" ) confirmation = { 'toList': [email], 'fromAddr': Config.getInstance().getSupportEmail(), 'subject': _("[Indico] Verify your email address"), 'body': body_format.format(self._avatar.getFirstName(), url) } # Send mail with template message and link GenericMailer.send(GenericNotification(confirmation)) return True
def _process(self): canManageRegistration = self._conf.canManageRegistration( self._getUser()) if not canManageRegistration and not self._regForm.isActivated(): p = registrationForm.WPRegFormInactive(self, self._conf) return p.display() params = self._getRequestParams() email = self._regForm.getPersonalData().getValueFromParams( params, 'email') if email is None: raise FormValuesError( _("An email address has to be set in order to make the registration in the event." )) elif not validMail(email, False): raise FormValuesError(_("The given email address is not valid.")) matchedUsers = AvatarHolder().match({"email": email}, exact=1) if matchedUsers: user = matchedUsers[0] else: user = None # Check if the user can register if not canManageRegistration: # normal user registering. Managers can. if self._conf.getRegistrationForm().isFull(): self._redirect( urlHandlers.UHConfRegistrationFormDisplay.getURL( self._conf)) return elif not self._conf.getRegistrationForm().inRegistrationPeriod(): p = registrationForm.WPRegistrationFormClosed(self, self._conf) return p.display() if user is None: if self._conf.hasRegistrantByEmail(email): raise FormValuesError( "There is already a user with the email \"%s\". Please choose another one" % email) else: if user.isRegisteredInConf( self._conf) or self._conf.hasRegistrantByEmail(email): if canManageRegistration: raise FormValuesError( "There is already a user with the email \"%s\". Please choose another one" % email) else: raise FormValuesError( "You have already registered with the email address \"%s\". If you need to modify your registration, please contact the managers of the conference." % email) rp = registration.Registrant() self._conf.addRegistrant(rp, user) rp.setValues(self._getRequestParams(), user) if user is not None: user.addRegistrant(rp) rp.setAvatar(user) # This creates the email to the new registrant and SENDS the email to the organizers if necessary... WTF. email = self._regForm.getNotification().createEmailNewRegistrant( self._regForm, rp) if self._regForm.isSendRegEmail() and rp.getEmail().strip(): modEticket = self._conf.getRegistrationForm().getETicket() if modEticket.isEnabled() and modEticket.isAttachedToEmail(): attachment = { 'name': "{0}-Ticket.pdf".format(self._target.getTitle()), 'binary': TicketToPDF(self._target, rp).getPDFBin(), } email["attachments"] = [attachment] GenericMailer.send(email) if canManageRegistration and user != self._getUser(): self._redirect(RHRegistrantListModif._uh.getURL(self._conf)) else: self._redirect( urlHandlers.UHConfRegistrationFormCreationDone.getURL(rp))
def _handleSet(self): if validMail(self._value) or self._value == "": self._target.setSupportEmail(self._value) else: raise ServiceError("ERR-E0", "E-mail address %s is not valid!" % self._value)
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", "") if newType != "" and newType != curType: wr = webFactoryRegistry.WebFactoryRegistry()