Changeset 7576 for cows_wps


Ignore:
Timestamp:
07/10/10 09:40:54 (9 years ago)
Author:
astephen
Message:

Now we can have multiple basedirs set in the config file.

Location:
cows_wps/trunk
Files:
6 edited

Legend:

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

    r7008 r7576  
    2828            return "ERROR: Please provide a valid proc_id." 
    2929 
     30        """ 
    3031        try: 
    3132            proc_config = createProcessConfig(proc_id)["Capabilities"] 
     
    4243        elif dr.find(basedir) < 0 and dr != basedir: 
    4344            return "ERROR: Invalid directory or not allowed." 
     45        """ 
     46        try: 
     47            proc_config = createProcessConfig(proc_id)["Capabilities"] 
     48            basedirs = proc_config["DataInputs"]["FilePath"]["basedir"] 
     49        except: 
     50            return "Unrecognised proc_id: %s" % proc_id 
     51 
     52        basedirs = [basedir.rstrip("/") for basedir in basedirs] 
     53 
     54        dr = os.path.split(path)[0] 
     55        top_dir = os.path.split(dr)[-1] 
     56 
     57        if not os.path.isdir(dr) or top_dir[0] == ".": 
     58            return "ERROR: Please provide a valid directory." 
     59        elif len([basedir for basedir in basedirs if dr.find(basedir) > -1]) == 0 and dr not in basedirs: 
     60             return "ERROR: Invalid directory or not allowed." 
    4461 
    4562        items = [os.path.join(dr, x) for x in os.listdir(dr) if x[0] != "."] 
  • cows_wps/trunk/cows_wps/public/js/ui/dynamic_form/dynamic_form_classes.js

    r7566 r7576  
    9797 
    9898 
    99 // updateFormOnAsyncResponse 
     99// updateFormOnAsyncResponseCallback 
    100100/*  - is called as response function after async requests */ 
    101101function updateFormOnAsyncResponseCallback(json) {  
     
    104104        return dynamic_form_manager.updateFormOnAsyncResponse(json); 
    105105} 
     106 
     107// respondToUnsuccessfulAsyncResponseCallback() { 
     108function respondToUnsuccessfulAsyncResponseCallback() { 
     109        alert("We have attempted to update the form but the request to the server created an error. Please check that you have made valid selections before clicking the \"Update form\" button."); 
     110        hideLoadingDiv(); 
     111}  
    106112 
    107113 
     
    216222                        dataType: "json", 
    217223                        success: updateFormOnAsyncResponseCallback, 
     224                        error: respondToUnsuccessfulAsyncResponseCallback 
    218225                }); 
    219226        }, 
  • cows_wps/trunk/cows_wps/renderer/proc_config_renderer.py

    r7535 r7576  
    234234            
    235235            elif tp == "filepath": 
    236                 base_dir = input["basedir"]  
    237                 resp += fm.renderTypeAheadDirList(name, base_dir) 
    238                 instruction += " Please type a file path on the CEDA file system. Click down to auto-fill with one of the options on the drop-down list." 
     236                basedirs = input["basedir"]  
     237                resp += fm.renderTypeAheadDirList(name, basedirs[0]) 
     238                instruction += " Please type a file path on the file system. Click down to auto-fill with one of the options on the drop-down list. Possible valid options are: <kbd>%s</kbd>." % ", ".join(basedirs) 
    239239 
    240240            elif tp == "bbox": 
  • cows_wps/trunk/cows_wps/utils/parse_capabilities_config.py

    r7535 r7576  
    55Code to parse the capabilities.ini config file for WPS in Python Paste. 
    66 
    7 Follows rules set out in: 
    8  
    9 http://proj.badc.rl.ac.uk/dcip/wiki/UkcipDdp/Tasks/BADCDevtTeam/WPSCode/DataTypeDescriptions 
    10  
    11 Name of entry    Values (or patterns)    Comments 
    12 ------------------------------------------------- 
    13 Sequence or not         "array" OR "item"       Only one of these used for every single entry 
    14 Type (or python type)   "string", "float", "int", OR "bool"     Booleans must be expressed as "True" or "False" 
    15 Length restrictions     <low>-<high>    Only relevant to "array" type. <low> and/or <high> can be omitted. Use just "-" for non-array types. 
    16 Keywords        "default:<default_value>" AND/OR "optional"     None, one or both, comma-separated. For neither just use "-" 
    17 Enumerated Values       <s1>,<s2>,<s3>  Comma-separated list of values that all entries must be one of. Use "-" for none. 
    187""" 
    198 
     
    8978                               "possible_values_url_template", 
    9079                               "possible_values_xml_path") 
     80    additional_params_to_split = ("basedir",) 
    9181 
    9282    # Create short name for d 
     
    126116                item_dict["dynamic"] = boolOrFalse(d.get(p + ".dynamic", False)) 
    127117 
    128                 """ 
    129                 if d.has_key(p + ".possible_values"): 
    130                     item_dict["possible_values"] = d[p + ".possible_values"].strip().split(",") 
    131                 else: 
    132                     item_dict["possible_values"]=None 
    133 """ 
    134  
    135118                if d.has_key(p + ".default"): 
    136119                    value = fixTrueFalse(d[p + ".default"].strip())  
     
    156139                    item_dict[i] = stripOrNone(d.get(p + "." + i, None)) 
    157140 
    158                 """ 
    159                 if d.has_key(p + ".schema"): 
    160                     item_dict["schema"] = d[p + ".schema"].strip() 
    161                 else: 
    162                     item_dict["schema"] = None 
    163  
    164                 if d.has_key(p + ".encoding"): 
    165                     item_dict["encoding"] = d[p + ".encoding"].strip() 
    166  
    167                 if d.has_key(p + ".mime_type"): 
    168                     item_dict["mime_type"] = d[p + ".mime_type"].strip() 
    169                 else: 
    170                     item_dict["mime_type"] = None 
    171 """ 
    172  
    173141                for add_option in additional_param_options: 
    174142                    key_name = p + "." + add_option 
     
    176144                    if d.has_key(key_name): 
    177145                        value = d[key_name].strip() 
     146 
     147                        if add_option in additional_params_to_split: 
     148                            value = value.split() 
     149 
    178150                        item_dict[add_option] = value  
    179151 
  • cows_wps/trunk/process_configs/ListPPFileHeader.ini

    r7573 r7576  
    2121[DataInputs] 
    2222FilePath = filepath 
    23 FilePath.basedir = /badc/ukmo-um/data 
     23#FilePath.basedir = /badc/ukmo-um/data 
     24FilePath.basedir = /badc/ukmo-um/data /badc/hadcm3/data /badc/africa-lam/data 
    2425 
    2526 
  • cows_wps/trunk/process_configs/SubsetPPFile.ini

    r7573 r7576  
    2121[DataInputs] 
    2222FilePath = filepath 
    23 FilePath.basedir = /badc/ukmo-um/data 
     23#FilePath.basedir = /badc/ukmo-um/data 
     24FilePath.basedir = /badc/ukmo-um/data /badc/hadcm3/data /badc/africa-lam/data 
    2425 
    2526StashCodes = int.list 
Note: See TracChangeset for help on using the changeset viewer.