Exemple #1
0
    def _process(self):
        start_dt, end_dt = get_access_dates(self.cern_access_request)
        expired = now_utc() > end_dt
        form = AccessIdentityDataForm()
        access_request = self.registration.cern_access_request
        email_ticket = self.registration.registration_form.ticket_on_email
        if access_request is not None and not access_request.has_identity_info and form.validate_on_submit(
        ):
            if expired:
                raise Forbidden
            form.populate_obj(access_request)
            db.session.flush()
            if email_ticket:
                send_ticket(self.registration)
            return redirect(
                url_for('.access_identity_data',
                        self.registration.locator.uuid))

        return WPAccessRequestDetails.render_template(
            'identity_data_form.html',
            self.event,
            form=form,
            access_request=access_request,
            start_dt=start_dt,
            end_dt=end_dt,
            expired=expired,
            email_ticket=email_ticket)
    def _process(self):
        form = AccessIdentityDataForm()
        access_request = self.registration.cern_access_request
        if access_request is not None and not access_request.has_identity_info and form.validate_on_submit():
            form.populate_obj(access_request)
            db.session.flush()
            send_ticket(self.registration)
            return redirect(url_for('.access_identity_data', self.registration.locator.uuid))

        start_dt, end_dt = get_access_dates(get_last_request(self.event))
        return WPAccessRequestDetails.render_template('identity_data_form.html', self.event, form=form,
                                                      access_request=access_request, start_dt=start_dt, end_dt=end_dt)
 def _process(self):
     access_request = self.registration.cern_access_request
     if not access_request or access_request.has_identity_info:
         raise UserValueError(_('The personal data for this registrant has already been entered'))
     form = AccessIdentityDataForm()
     if form.validate_on_submit():
         form.populate_obj(access_request)
         db.session.flush()
         send_ticket(self.registration)
         return jsonify_data(html=render_plugin_template('cern_access_status.html', registration=self.registration,
                                                         header=False))
     return jsonify_template('identity_data_form_management.html', render_plugin_template, form=form,
                             registration=self.registration)
    def _process(self):
        start_dt, end_dt = get_access_dates(self.cern_access_request)
        expired = now_utc() > end_dt
        form = AccessIdentityDataForm()
        access_request = self.registration.cern_access_request
        email_ticket = self.registration.registration_form.ticket_on_email
        if access_request is not None and not access_request.has_identity_info and form.validate_on_submit(
        ):
            if expired:
                raise Forbidden

            form.populate_obj(access_request, skip={'license_plate'})
            access_request.license_plate = (
                sanitize_license_plate(form.license_plate.data)
                if form.by_car.data and form.license_plate.data else None)

            db.session.flush()

            # if the user has entered car plate info, we have to provide it to ADAMS
            if form.by_car.data:
                send_adams_post_request(self.event, [self.registration],
                                        update=True)
            if email_ticket:
                send_ticket(self.registration)
            return redirect(
                url_for('.access_identity_data',
                        self.registration.locator.uuid))

        return WPAccessRequestDetails.render_template(
            'identity_data_form.html',
            self.event,
            form=form,
            access_request=access_request,
            start_dt=start_dt,
            end_dt=end_dt,
            expired=expired,
            email_ticket=email_ticket)