Changeset 7633 for cows_wps


Ignore:
Timestamp:
19/10/10 16:56:41 (9 years ago)
Author:
astephen
Message:

Fixes to bugs in responses when not logged in, and added datatypes as
list for GetWeatherStations?.

Location:
cows_wps/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cows_wps/trunk/cows_wps/controllers/jobs.py

    r7116 r7633  
    105105        (args, bad_args) = self._parseArgs(admin = admin) 
    106106 
     107        renderer = UIPageRenderer() 
     108 
    107109        if admin == False: 
    108110            try: 
     
    110112                args["user_id_match"] = user_id 
    111113            except: 
    112                 raise Exception("Jobs page is only visible to a valid user or system administrator.  Please login.") 
     114                return renderer.render("Jobs page",  
     115                                [("Jobs page - login required", "The jobs page is only visible to a valid user or system administrator.  Please login.")]) 
    113116        else: 
    114117            user_id = None 
  • cows_wps/trunk/cows_wps/controllers/jobviewer.py

    r7610 r7633  
    4242        job_xml = getter.read() 
    4343        getter.close() 
    44   
    45         job_as_table = self._xmlToTable(job_xml) 
    46         job_xml_encoded = self._htmlifyXML(job_xml) 
    47         job_as_plots = "There are no plots available in the outputs of this job." 
    48  
    49         # General info first... 
     44 
     45        self.status = None  
     46        # A by-product of the XML parsing is resolving the status 
     47        parsed_resp = self._xmlToTableAndResolveStatus(job_xml) 
     48        if self.status == "failed": 
     49            normal_view = """<div><b>Sorry, there was a problem running this job. The job failed with the following message:</b></div> 
     50    <div>%s</div>""" % (parsed_resp.lstrip("Exception=").lstrip()) 
     51        else: 
     52            normal_view = parsed_resp 
     53            job_xml_encoded = self._htmlifyXML(job_xml) 
     54            job_as_plots = "There are no plots available in the outputs of this job." 
     55 
     56 
    5057        resp = """Please note that offline jobs are scheduled and may take a long time to run. This page will continue to poll offline jobs when they are running unless you click the "stop polling" option when it is visible. You will receive an e-mail when your offline job has run so you do not need to stay on this page. Note that you can view all previous jobs on the <a href="/jobs">Jobs page</a>.<br><br>""" 
    5158 
     
    6471<div id="view_container" style="background: white; border: 2px outset blue; padding: 5px;"> 
    6572        <div id="view_contents"> 
    66                 <div id="table_view" style="visibility: visible; height: auto;">%s%s</div>""" % (poll_info_div, job_as_table) 
     73                <div id="table_view" style="visibility: visible; height: auto;">%s%s</div>""" % (poll_info_div, normal_view) 
    6774 
    6875        if self.status == "complete": 
     
    104111            raise Exception("Could not match status tag.") 
    105112 
    106     def _xmlToTable(self, xml): 
     113    def _xmlToTableAndResolveStatus(self, xml): 
    107114        "Chops up xml to get table of outputs." 
    108115        self.node = ET.fromstring(xml) 
     
    111118 
    112119        self.status = self._resolveStatus(self.node.find("{" + self.namespace + "}Status"))  
     120 
     121        # If failed then grab the Exception text 
     122        if self.status == "failed": 
     123            ons = self.namespace_ows 
     124            wns = self.namespace 
     125            # Set job id from status URL as not in exception reesopnse 
     126            self.job_id = self.node.get("statusLocation").split("/")[-1] 
     127 
     128            return self.node.find("{%s}Status/{%s}ProcessFailed/{%s}ExceptionReport/{%s}Exception/{%s}ExceptionText" % (wns, wns, ons, ons, ons)).text 
    113129 
    114130        job_details = self.node.find("{" + self.namespace +  "}ProcessOutputs").find("{" + self.namespace +  "}Output").find("{" + self.namespace +  "}ComplexValue").find("{" + self.namespace +  "}WPSResponseDetails").find("{" + self.namespace +  "}JobDetails") 
  • cows_wps/trunk/process_configs/GetWeatherStations.ini

    r7019 r7633  
    3232DataTypes = string.list 
    3333DataTypes.optional = True 
     34DataTypes.possible_values = CLBD,CLBN,CLBR,CLBW,DCNN,FIXD,ICAO,LPMS,RAIN,SHIP,WIND,WMO 
    3435 
    3536[ProcessOutputs] 
Note: See TracChangeset for help on using the changeset viewer.