Changeset 515

Show
Ignore:
Timestamp:
10/18/06 00:13:45
Author:
seang
Message:

implement getcapabilities for WebFeatureService?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OWSLib/trunk/owslib/wfs.py

    r514 r515  
    2222 
    2323import cgi 
    24 import urllib 
     24from urllib import urlencode, urlopen 
     25 
    2526from etree import etree 
    2627 
     
    166167        self.crsOptions = [srs.text for srs in elem.findall(nspath('SRS'))] 
    167168 
     169        # verbs 
     170        self.verbOptions = [op.tag for op \ 
     171            in parent.findall(nspath('Operations/*'))] 
     172        self.verbOptions + [op.tag for op \ 
     173            in elem.findall(nspath('Operations/*')) \ 
     174            if op.tag not in self.verbOptions] 
     175         
    168176 
    169177class OperationMetadata: 
     
    314322            qs.append(('version', self.version)) 
    315323 
    316         urlqs = urllib.urlencode(tuple(qs)) 
     324        urlqs = urlencode(tuple(qs)) 
    317325        return service_url.split('?')[0] + '?' + urlqs 
    318326 
     
    327335        """ 
    328336        request = self.capabilities_url(url) 
    329         u = urllib.urlopen(request) 
     337        u = urlopen(request) 
    330338        return WFSCapabilitiesInfoset(etree.fromstring(u.read())) 
    331339 
  • OWSLib/trunk/tests/MapServerWFSCapabilities.txt

    r514 r515  
    3232    >>> wfs.capabilities.getContentByName('IBA').crsOptions 
    3333    ['EPSG:4326'] 
     34    >>> wfs.capabilities.getContentByName('IBA').verbOptions 
     35    ['{http://www.opengis.net/wfs}Query'] 
    3436     
    3537Expect a KeyError for invalid names 
     
    5153Lastly, test the getcapabilities method 
    5254 
     55    >>> wfs = WebFeatureService('http://www.bsc-eoc.org/cgi-bin/bsc_ows.asp?', version='1.0') 
     56    >>> xml = wfs.getcapabilities().read() 
     57    >>> xml.find('<WFS_Capabilities') > 0 
     58    True 
     59