예제 #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_or_404(request.view_args['reg_form_id'])
        if regform.cern_access_request and regform.cern_access_request.is_active and not form.tickets_enabled.data:
            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_or_404(
            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_or_404(request.view_args['template_id'])
     all_badge_templates = [tpl for tpl in get_all_templates(self.category)
                            if tpl.type == TemplateType.badge and not tpl.is_ticket]
     if template not in all_badge_templates:
         raise Exception('Invalid template')
     if template == self.category.default_badge_template:
         # already the default -> clear it
         self.category.default_badge_template = None
     elif template == get_default_badge_on_category(self.category, only_inherited=True):
         # already the inherited default -> clear it instead of setting it explicitly
         self.category.default_badge_template = None
     else:
         self.category.default_badge_template = template
     if self.category.is_root and not self.category.default_badge_template:
         raise Exception('Cannot clear default ticket template on root category')
     return jsonify_data(html=_render_template_list(self.category))
예제 #3
0
 def _process_args(self):
     self.template = DesignerTemplate.get_or_404(request.view_args['template_id'])
예제 #4
0
 def _process_args(self):
     RHRegistrationsActionBase._process_args(self)
     self.template = DesignerTemplate.get_or_404(
         request.view_args['template_id'])
예제 #5
0
 def _process_args(self):
     RHManageEventBase._process_args(self)
     self.template = DesignerTemplate.get_or_404(request.view_args['template_id'])
예제 #6
0
파일: controllers.py 프로젝트: javfg/indico
 def _process_args(self):
     self.template = DesignerTemplate.get_or_404(
         request.view_args['template_id'])
     if self.target.is_deleted:
         raise NotFound