source: cows_wps/trunk/cows_wps/controllers/submit.py @ 5956

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/cows_wps/controllers/submit.py@5956
Revision 5956, 1.5 KB checked in by astephen, 12 years ago (diff)

added

Line 
1import logging
2
3from pylons import request, response, session, tmpl_context as c
4from pylons.controllers.util import abort, redirect_to
5
6from cows_wps.renderer.ui_renderer import *
7from cows_wps.controllers import *
8from cows_wps.lib.ui.proc_config import *
9
10log = logging.getLogger(__name__)
11
12
13class SubmitController(BaseController):
14
15    def index(self):
16        """
17        Submits a job.
18        """
19        args = {}
20        for (key, value) in request.params.items():
21            args[str(key)] = str(value) 
22
23        proc_id = args["proc_id"]
24        del args["proc_id"]
25
26        wps_url_base = """/wps?Request=Execute&Format=text/xml&Identifier=%s&Store=false&Status=false&DataInputs="""
27        wps_request = wps_url_base % proc_id
28
29        for (key, value) in args.items():
30            wps_request += "%s,%s," % (key, value)
31
32        # remove comma
33        wps_request = wps_request[:-1]
34
35        return redirect_to(wps_request) 
36        return "Do I get here?"
37
38    def form(self):
39        """
40        Displays a form for submitting a job.
41        """
42        proc = request.params.get("proc_id", None)
43        if proc == None:
44            return "Please provide an argument proc_id=<Something>"
45
46        pc = ProcConfig()
47        proc_submission_form_html = pc.renderProcSubmissionForm(proc)
48        resp = proc_submission_form_html
49
50        renderer = UIPageRenderer()
51        resp = renderer.render("Submission Form for: '%s'" % proc,
52                               [("Define your inputs", resp)])
53        return resp
54
Note: See TracBrowser for help on using the repository browser.