Changeset 7573


Ignore:
Timestamp:
05/10/10 16:23:24 (9 years ago)
Author:
astephen
Message:

fixed wps namespace in lookup.

Location:
cows_wps/trunk
Files:
5 edited

Legend:

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

    r7535 r7573  
    233233        # and this set of arguments 
    234234        rh = RoleHandler() 
    235         authorisedRoles = rh.getRoleNumberFromProcessIDAndArgs(identifier, arg_dict)  
     235 
     236        try: 
     237            authorisedRoles = rh.getRoleNumberFromProcessIDAndArgs(identifier, arg_dict)  
     238        except: 
     239            raise OwsError("""The WPS does not recognise the resource you are trying to access. 
     240Since it cannot reconcile the access restrictions the resource cannot be made available. 
     241Please report this problem if you believe that the resource you have requested should be visible to you.""") 
    236242 
    237243        # Update the cache with any completed requests before consulting the cache 
  • cows_wps/trunk/cows_wps/templates/ui_template.html

    r7538 r7573  
    147147</div> <!-- main ends --> 
    148148 
    149 <div id="waiting"></div> 
     149<div id="loading"></div> 
    150150 
    151151</body> 
  • cows_wps/trunk/cows_wps/utils/common.py

    r7525 r7573  
    1717import urllib2 
    1818import Cookie 
     19import xml.etree.ElementTree as ET 
    1920 
    2021#from cows_wps.utils import case_sensitive_ordered_config_parser as cp 
     
    270271 
    271272 
     273def extractFromXML(xml, xml_path): 
     274    """ 
     275    Extracts a list of items from an XML string/doc. The list is found in 
     276    the xml_path lookup which is represented like a file path. E.g. 
     277 
     278        Extracts values at xml_path location within XML response 
     279        E.g. <person><job>nurse mother</job></person> and "person/job" will resturn ["nurse", "mother"] 
     280 
     281    """ 
     282#    fout = open("/tmp/xml.xml", "w"); fout.write(xml) ; fout.close() 
     283    node = ET.fromstring(xml) 
     284 
     285    namespace_map = {"gml": "http://www.opengis.net/gml", 
     286                     "wcs": "http://www.opengis.net/wcs", 
     287                     "ows": "http://www.opengeospatial.net/ows", 
     288                     "wps": "http://www.opengeospatial.net/wps",  
     289                    } 
     290 
     291    path_parts = xml_path.split("/")[1:] 
     292    this_node = node 
     293 
     294    for item in path_parts: 
     295        log.warn("item: %s" % str(this_node)) 
     296 
     297        for (id, ns) in namespace_map.items(): 
     298            if item.find("%s:" % id) == 0: 
     299                search_item = "{%s}%s" % (ns, item.split(":")[-1]) 
     300                break 
     301        else: 
     302            search_item = item 
     303 
     304        print this_node, search_item 
     305        this_node = this_node.find(search_item) 
     306        
     307 
     308    try: 
     309        extracted_list = this_node.text.split() 
     310        return extracted_list 
     311    except: 
     312        raise Exception("Could not extract element from XML using xml path: '%s'" % xml_path) 
     313 
     314  
    272315def mapDownloadURLToFilePath(url): 
    273316    from cows_wps.model.managers import requestManager 
  • cows_wps/trunk/process_configs/ListPPFileHeader.ini

    r7328 r7573  
    2121[DataInputs] 
    2222FilePath = filepath 
    23 FilePath.basedir = /disks/kona1/cwps-test-data/africa-lam  
     23FilePath.basedir = /badc/ukmo-um/data 
    2424 
    2525 
  • cows_wps/trunk/process_configs/SubsetPPFile.ini

    r7535 r7573  
    2121[DataInputs] 
    2222FilePath = filepath 
    23 #FilePath.basedir = /disks/kona1/cwps-test-data/africa-lam 
    2423FilePath.basedir = /badc/ukmo-um/data 
    25 #FilePath.argument_trigger = StashCodes 
    2624 
    2725StashCodes = int.list 
    2826StashCodes.dynamic = True 
    29 StashCodes.possible_values_url_template = http://ceda-wps1.badc.rl.ac.uk/wps?Request=Execute&Format=text/xml&Identifier=ListPPFileHeader&Store=false&Status=false&DataInputs=FilePath,${FilePath} 
    30 StashCodes.possible_values_xml_pathFULL = ExecuteResponse/ProcessOutputs/Output/WPSResponseDetails/ProcessSpecificContent/StashCodes 
    31 StashCodes.possible_values_xml_path = StashCodes 
     27StashCodes.possible_values_url_template = http://ceda-wps1.badc.rl.ac.uk/ajax_proxy/call_service?url=http%3A//ceda-wps1.badc.rl.ac.uk/wps%3FRequest%3DExecute%26Format%3Dtext/xml%26Identifier%3DListPPFileHeader%26Store%3Dfalse%26Status%3Dfalse%26DataInputs%3DFilePath%2C${FilePath}&xml_path=wps:ExecuteResponse/wps:ProcessOutputs/wps:Output/wps:ComplexValue/wps:WPSResponseDetails/wps:ProcessSpecificContent/wps:StashCodes 
     28StashCodes.possible_values_xml_path = ExecuteResponse/ProcessOutputs/Output/WPSResponseDetails/ProcessSpecificContent/StashCodes 
    3229 
    3330[ProcessOutputs] 
Note: See TracChangeset for help on using the changeset viewer.