def view(self): form = self.generate_form() if 'submit' in self.request.POST: return self.process_form(form) if not has_execute_permission(self.request, self.service_name): self.session.flash("You are not allowed to execute processes. Please sign-in.", queue='warning') return dict( process=self.process, url=wps_describe_url(self.wps.url, self.processid), form=form.render(self.appstruct()))
def view(self): form = self.generate_form() if 'submit' in self.request.POST: check_csrf_token(self.request) return self.process_form(form) if not has_execute_permission(self.request, self.service_name): msg = """<strong>Warning:</strong> You are not allowed to run this process. Please <a href="{0}" class="alert-link">sign in</a> and wait for account activation.""" msg = msg.format(self.request.route_path('sign_in')) self.session.flash(msg, queue='warning') return dict(process=self.process, url=wps_describe_url(self.wps.url, self.processid), form=form.render(self.appstruct()))
def generate_form(self, formid='deform'): schema = WPSSchema(request=self.request, process=self.process, use_async=self.request.has_permission('submit'), user=self.get_user()) submit_button = Button(name='submit', title='Execute', css_class='btn btn-success btn-lg btn-block', disabled=not has_execute_permission( self.request, self.service_name)) return Form( schema, buttons=(submit_button,), formid=formid, )
def view(self): form = self.generate_form() if 'submit' in self.request.POST: check_csrf_token(self.request) return self.process_form(form) if not has_execute_permission(self.request, self.service_name): msg = """<strong>Warning:</strong> You are not allowed to run this process. Please <a href="{0}" class="alert-link">sign in</a> and wait for account activation.""" msg = msg.format(self.request.route_path('sign_in')) self.session.flash(msg, queue='warning') elif not self.request.cert_ok: msg = """<strong>Warning:</strong> You are not allowed to access ESGF data. Please <a href="{0}" class="alert-link">update</a> your ESGF credentials.""" callback = self.request.current_route_path() self.session.flash(msg.format( self.request.route_path('esgflogon', _query=[('callback', callback)])), queue='warning') return dict(process=self.process, url=wps_describe_url(self.wps.url, self.processid), form=form.render(self.appstruct()))