Changeset 4400


Ignore:
Timestamp:
30/10/08 16:14:46 (11 years ago)
Author:
domlowe
Message:

More code to support StoredQuery? handling

Location:
cows/trunk/cows
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cows/trunk/cows/pylons/wfs_controller.py

    r4398 r4400  
    162162                                        'version') 
    163163 
     164        #The GetFeature request may either use the 'query' filter encoding or a  
     165        #storedquery, but not both: 
     166#        if self.getOwsParam('storedquery_id'): 
     167         
    164168        #Parse the query to analyse the filters it contains 
    165         queryxml=self.getOwsParam('query') 
    166         qp=FEQueryProcessor() 
    167         c.resultset=qp.evaluate(self.featureset, queryxml) 
    168         log.debug('Final resultset from query processor %s'%c.resultset) 
    169          
     169        queryxml=self.getOwsParam('query',default=None) 
     170        storedqueryid=self.getOwsParam('storedquery_id', default=None) 
     171        if queryxml: 
     172            qp=FEQueryProcessor() 
     173            c.resultset=qp.evaluate(self.featureset, queryxml) 
     174            log.debug('Final resultset from query processor %s'%c.resultset) 
     175        elif storedqueryid: 
     176            storedquery, func=self.layerMapper.queryDescriptions.queries[storedqueryid] 
     177            c.resultset=func(arg1='cat', arg2='dog') 
     178            log.debug('Final resultset from stored query %s'%c.resultset) 
     179        else: 
     180            pass #TODO need to raise error if neither query or storedquery_id are provided 
    170181        
    171182        #Group resultset together in a wfs feature collection (use template) 
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmllayer.py

    r4398 r4400  
    33 
    44""" 
    5  
     5import cows.service.imps.csmlbackend.wfs_csmlstoredqueries as CSMLQueries 
    66from cows.service.imps.csmlbackend.csmlcommon import CSMLLayerMapper, CSMLConnector 
    77from cows.service.wfs_iface import * 
     
    8787    def __init__(self): 
    8888        #self.queries is a dictionary of form: {id:(StoredQuery, func)} 
    89         #where fun is the name of the implementation of the stored query (typically) in wfs_csmlstoredqueries 
     89        #where func is the name of the implementation of the stored query (typically) in wfs_csmlstoredqueries 
    9090        self.queries={} 
    9191        qid='queryOne' 
    9292        query=StoredQuery(qid) 
    93         self.queries[qid]=(query, 'query_one_func') 
     93        self.queries[qid]=(query, CSMLQueries.query_one_func) 
    9494        qid='queryTwo' 
    9595        query=StoredQuery(qid) 
    96         self.queries[qid]=(query, 'query_two_func')       
     96        self.queries[qid]=(query, CSMLQueries.query_two_func)       
    9797         
    9898 
  • cows/trunk/cows/service/imps/csmlbackend/wfs_csmlstoredqueries.py

    r4399 r4400  
    66""" 
    77 
     8class dummyfeaturefortesting(object): 
     9    def __init__(self, x): 
     10        self.x=x 
     11    def toGML(self): 
     12        return '<someGML>%s</someGML>'%self.x 
     13 
     14def query_one_func(arg1=None, arg2=None): 
     15    result = [dummyfeaturefortesting('blah1')] 
     16    return result 
     17 
     18def query_two_func(arg1=None, arg2=None): 
     19    result = [dummyfeaturefortesting('blah2')] 
     20    return result 
Note: See TracChangeset for help on using the changeset viewer.