Пример #1
0
    def _form_validated(self, form, **kwargs):
        """
        Forbid to disable the tickets when access to CERN is requested and
        to use CERN access ticket template with regforms without active CERN access request.
        """
        if not isinstance(form, TicketsForm):
            return

        regform = RegistrationForm.get_one(request.view_args['reg_form_id'])
        if regform.cern_access_request and regform.cern_access_request.is_active and form.tickets_enabled.data is False:
            err = _(
                'This form is used to grant CERN site access so ticketing must be enabled'
            )
            form.tickets_enabled.errors.append(err)
            return False
        access_tpl = self.settings.get('access_ticket_template')
        ticket_template = DesignerTemplate.get_one(
            form.ticket_template_id.data)
        if not access_tpl:
            return
        if ticket_template == access_tpl or ticket_template.backside_template == access_tpl:
            if (not regform.cern_access_request
                    or (regform.cern_access_request
                        and regform.cern_access_request.request_state !=
                        CERNAccessRequestState.active)):
                form.ticket_template_id.errors.append(
                    _('The selected template can only be used with an '
                      'active CERN access request'))
                return False
Пример #2
0
 def _process(self):
     template = DesignerTemplate.get_one(request.view_args['template_id'])
     if template not in get_all_templates(self.category):
         raise Exception('Invalid template')
     if template == self.category.default_ticket_template:
         # already the default -> clear it
         self.category.default_ticket_template = None
     elif template == get_default_template_on_category(self.category, only_inherited=True):
         # already the inherited default -> clear it instead of setting it explicitly
         self.category.default_ticket_template = None
     else:
         self.category.default_ticket_template = template
     if self.category.is_root and not self.category.default_ticket_template:
         raise Exception('Cannot clear default ticket template on root category')
     return jsonify_data(html=_render_template_list(self.category))
Пример #3
0
 def _process(self):
     template = DesignerTemplate.get_one(request.view_args['template_id'])
     if template not in get_all_templates(self.category):
         raise Exception('Invalid template')
     if template == self.category.default_ticket_template:
         # already the default -> clear it
         self.category.default_ticket_template = None
     elif template == get_default_template_on_category(self.category, only_inherited=True):
         # already the inherited default -> clear it instead of setting it explicitly
         self.category.default_ticket_template = None
     else:
         self.category.default_ticket_template = template
     if self.category.is_root and not self.category.default_ticket_template:
         raise Exception('Cannot clear default ticket template on root category')
     return jsonify_data(html=_render_template_list(self.category))
Пример #4
0
 def _process_args(self):
     RHManageEventBase._process_args(self)
     self.template = DesignerTemplate.get_one(
         request.view_args['template_id'])
Пример #5
0
 def _checkParams(self, params):
     RHRegistrationsActionBase._checkParams(self, params)
     self.template = DesignerTemplate.get_one(
         request.view_args['template_id'])
Пример #6
0
 def _process_args(self):
     self.template = DesignerTemplate.get_one(
         request.view_args['template_id'])
Пример #7
0
 def _process_args(self):
     RHRegistrationsActionBase._process_args(self)
     self.template = DesignerTemplate.get_one(request.view_args['template_id'])
Пример #8
0
 def _process_args(self):
     RHManageEventBase._process_args(self)
     self.template = DesignerTemplate.get_one(request.view_args['template_id'])
Пример #9
0
 def _process_args(self):
     self.template = DesignerTemplate.get_one(request.view_args['template_id'])
Пример #10
0
 def _process_args(self):
     RHRegistrationsActionBase._process_args(self)
     self.template = DesignerTemplate.get_one(request.view_args['template_id'])
Пример #11
0
 def _checkParams(self):
     self.template = DesignerTemplate.get_one(
         request.view_args['template_id'])
Пример #12
0
 def _checkParams(self, params):
     RHManageEventBase._checkParams(self, params)
     self.template = DesignerTemplate.get_one(
         request.view_args['template_id'])