Exemplo n.º 1
0
 def view(self):
     dataInputs = getattr(self.process, 'dataInputs', [])
     json_inputs = [{
         'dataType':
         data_input.dataType,
         'name':
         getattr(data_input, 'identifier', ''),
         'title':
         getattr(data_input, 'title', ''),
         'description':
         getattr(data_input, 'abstract', ''),
         'defaultValue':
         self.jsonify(getattr(data_input, 'defaultValue', None)),
         'minOccurs':
         getattr(data_input, 'minOccurs', 0),
         'maxOccurs':
         getattr(data_input, 'maxOccurs', 0),
         'allowedValues': [
             self.jsonify(value)
             for value in getattr(data_input, 'allowedValues', [])
         ],
         'supportedValues': [
             self.jsonify(value)
             for value in getattr(data_input, 'supportedValues', [])
         ]
     } for data_input in dataInputs]
     return dict(description=getattr(self.process, 'abstract', ''),
                 url=wps_describe_url(self.wps.url, self.processid),
                 inputs=json_inputs)
Exemplo n.º 2
0
 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()))
Exemplo n.º 3
0
 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()))
Exemplo n.º 4
0
 def process_form(self, form):
     controls = self.request.POST.items()
     try:
         # TODO: uploader puts qqfile in controls
         controls = [control for control in controls if 'qqfile' not in control[0]]
         LOGGER.debug("before validate %s", controls)
         appstruct = form.validate(controls)
         LOGGER.debug("before execute %s", appstruct)
         job_id = self.execute(appstruct)
     except ValidationFailure, e:
         self.session.flash("Page validation failed.", queue='danger')
         return dict(process=self.process,
                     url=wps_describe_url(self.wps.url, self.processid),
                     form=e.render())
Exemplo n.º 5
0
 def process_form(self, form):
     controls = self.request.POST.items()
     try:
         # TODO: uploader puts qqfile in controls
         controls = [control for control in controls if 'qqfile' not in control[0]]
         logger.debug("before validate %s", controls)
         appstruct = form.validate(controls)
         logger.debug("before execute %s", appstruct)
         self.execute(appstruct)
     except ValidationFailure, e:
         logger.exception('validation of exectue view failed.')
         self.session.flash("There are errors on this page.", queue='danger')
         return dict(process=self.process,
                     url=wps_describe_url(self.wps.url, self.processid),
                     form=e.render())
Exemplo n.º 6
0
 def view(self):
     dataInputs = getattr(self.process, 'dataInputs', [])
     json_inputs = [{'dataType': data_input.dataType,
                     'name': getattr(data_input, 'identifier', ''),
                     'title': getattr(data_input, 'title', ''),
                     'description': getattr(data_input, 'abstract', ''),
                     'defaultValue': self.jsonify(getattr(data_input, 'defaultValue', None)),
                     'minOccurs': getattr(data_input, 'minOccurs', 0),
                     'maxOccurs': getattr(data_input, 'maxOccurs', 0),
                     'allowedValues': [self.jsonify(value) for value in getattr(data_input, 'allowedValues', [])],
                     'supportedValues': [self.jsonify(value) for value in getattr(data_input, 'supportedValues', [])]
                     } for data_input in dataInputs]
     return dict(
         description=getattr(self.process, 'abstract', ''),
         url=wps_describe_url(self.wps.url, self.processid),
         inputs=json_inputs)
Exemplo n.º 7
0
 def process_form(self, form):
     controls = list(self.request.POST.items())
     try:
         # TODO: uploader puts qqfile in controls
         controls = [control for control in controls if 'qqfile' not in control[0]]
         LOGGER.debug("before validate %s", controls)
         appstruct = form.validate(controls)
         LOGGER.debug("before execute %s", appstruct)
         job_id = self.execute(appstruct)
     except ValidationFailure as e:
         self.session.flash("Page validation failed.", queue='danger')
         return dict(process=self.process,
                     url=wps_describe_url(self.wps.url, self.processid),
                     form=e.render())
     else:
         if not self.request.user:  # not logged-in
             return HTTPFound(location=self.request.route_url('job_status', job_id=job_id))
         else:
             return HTTPFound(location=self.request.route_url('monitor'))
Exemplo n.º 8
0
 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 self.has_execute_permission():
         if self.request.user is not None:
             msg = """<strong>Warning:</strong> You are not allowed to run this
             process as you do not have access to the datasets. Please contact the
             CEDA Helpdesk for more information about applying for access to the
             required resources. Include a copy of the URL above to indicate which
             resources you are trying to access."""
         else:
             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()))
Exemplo n.º 9
0
 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()))
Exemplo n.º 10
0
 def custom_view(self):
     return dict(summary_title=self.process.title,
                 summary=getattr(self.process, 'abstract', 'No summary'),
                 url=wps_describe_url(self.wps.url,
                                      self.process.identifier),
                 metadata=self.process.metadata)