Exemple #1
0
class WFSRequest(object):
    dom = None
    data = ""
    parser = None

    transaction = None
    filter = None

    def __init__(self):
        self.parser = objectify.makeparser(remove_blank_text=True,
                                           ns_clean=True)

    def parse(self, data):
        self.data = data
        #self.data = self.data.replace('wildCard="*"', 'wildCard="\*"')
        #self.data = self.data.replace('wildCard="?"', 'wildCard="\?"')
        #self.data = self.data.replace('singleChar="*"', 'singleChar="\*"')
        #self.data = self.data.replace('singleChar="?"', 'singleChar="\?"')

        try:
            self.dom = etree.XML(self.data, parser=self.parser)
        except Exception as e:
            ''' '''

    def render(self, datasource):
        '''
        Renders a FilterEncoding to its SQL
        '''
        query = self.dom.xpath("//*[local-name() = 'Query']")
        if len(query) > 0:
            #query - return a dummy select object
            self.filter = FilterEncoding(deepcopy(query[0]).getchildren()[0])
        else:
            self.filter = FilterEncoding(self.data)

        self.filter.parse()
        return self.filter.render(datasource)

    def getActions(self):
        '''
        Returns all WFS-T transactions
        '''
        if self.dom is None:
            return None

        query = self.dom.xpath("//*[local-name() = 'Query']")
        if len(query) > 0:
            #query - return a dummy select object
            return [
                Select(etree.tostring(deepcopy(query[0]).getchildren()[0]))
            ]
        else:
            # returning all transaction objects in a array
            self.transaction = Transaction()
            self.transaction.parse(self.data)
            return self.transaction.getActions()

        return None
class WFSRequest(object):
    dom     = None
    data    = ""
    parser  = None
    
    transaction = None
    filter = None
    
    def __init__(self):
        self.parser = objectify.makeparser(remove_blank_text=True, ns_clean=True)

    def parse(self, data):
        self.data = data
        #self.data = self.data.replace('wildCard="*"', 'wildCard="\*"')
        #self.data = self.data.replace('wildCard="?"', 'wildCard="\?"')
        #self.data = self.data.replace('singleChar="*"', 'singleChar="\*"')
        #self.data = self.data.replace('singleChar="?"', 'singleChar="\?"')

        try:
            self.dom = etree.XML(self.data, parser=self.parser)
        except Exception as e:
            ''' '''
    
        
    def render(self, datasource):
        '''
        Renders a FilterEncoding to its SQL
        '''
        query = self.dom.xpath("//*[local-name() = 'Query']")
        if len(query) > 0:
            #query - return a dummy select object
            self.filter = FilterEncoding(deepcopy(query[0]).getchildren()[0])
        else:
            self.filter = FilterEncoding(self.data)

        self.filter.parse()
        return self.filter.render(datasource)
    
    def getActions(self):
        '''
        Returns all WFS-T transactions
        '''
        if self.dom is None:
            return None
        
        query = self.dom.xpath("//*[local-name() = 'Query']")
        if len(query) > 0:
            #query - return a dummy select object
            return [Select(etree.tostring(deepcopy(query[0]).getchildren()[0]))]
        else:
            # returning all transaction objects in a array 
            self.transaction = Transaction()
            self.transaction.parse(self.data)
            return self.transaction.getActions()
        
        return None
            
Exemple #3
0
    def getActions(self):
        '''
        Returns all WFS-T transactions
        '''
        query = self.dom.xpath("//*[local-name() = 'Query']")
        if len(query) > 0:
            #query - return a dummy select object
            return [
                Select(etree.tostring(deepcopy(query[0]).getchildren()[0]))
            ]
        else:
            # returning all transaction objects in a array
            self.transaction = Transaction()
            self.transaction.parse(self.data)
            return self.transaction.getActions()

        return None
Exemple #4
0
 def getActions(self):
     '''
     Returns all WFS-T transactions
     '''
     query = self.dom.xpath("//*[local-name() = 'Query']")
     if len(query) > 0:
         #query - return a dummy select object
         return [Select(etree.tostring(deepcopy(query[0]).getchildren()[0]))]
     else:
         # returning all transaction objects in a array 
         self.transaction = Transaction()
         self.transaction.parse(self.data)
         return self.transaction.getActions()
     
     return None