Changeset 602

Show
Ignore:
Timestamp:
12/20/06 08:22:41
Author:
seang
Message:

added service contact metadata and interface (#93)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • OWSLib/trunk/CREDITS.txt

    r599 r602  
    22Julien Anguenot <ja@nuxeo.com> 
    33Kai Hanninen <kai.hanninen@mbconcert.fi> 
    4  
     4Jo Walsh <jo@frot.org> 
  • OWSLib/trunk/owslib/interfaces.py

    r514 r602  
    107107    """ 
    108108 
     109class IContactMetadata: 
     110    """OO-interface to OWS metadata. 
     111 
     112    Properties 
     113    ---------- 
     114    name : string 
     115    organization : string 
     116    address : string 
     117    city : string 
     118    region : string 
     119    postcode : string 
     120    country : string 
     121    email : string 
     122    """ 
     123 
    109124class IMethodMetadata: 
    110125    """OO-interface to WMS metadata. 
     
    151166    """ 
    152167 
     168 
  • OWSLib/trunk/owslib/wfs.py

    r523 r602  
    176176        for elem in self._root.findall(nspath('FeatureTypeList/FeatureType')): 
    177177            self.contents.append(ContentMetadata(elem, top)) 
    178           
     178         
     179        # keywords 
     180        self.keywords = [] 
     181 
     182        self.provider = None 
     183 
     184 
    179185    def getContentByName(self, name): 
    180186        """Return a named content item.""" 
  • OWSLib/trunk/owslib/wms.py

    r526 r602  
    194194        for elem in self._root.findall('Capability/Layer/Layer'): 
    195195            self.contents.append(ContentMetadata(elem, top)) 
    196           
     196 
     197        # keywords 
     198        self.keywords = [f.text for f in self._root.findall('Service/KeywordList/Keyword')] 
     199         
     200        # contact person 
     201        self.contact = ContactMetadata(self._root.find('Service/ContactInformation')) 
     202         
    197203    def getContentByName(self, name): 
    198204        """Return a named content item.""" 
     
    280286            methods.append((verb.tag, {'url': url})) 
    281287        self.methods = dict(methods) 
    282         
     288 
     289 
     290class ContactMetadata: 
     291    """Abstraction for contact details advertised in GetCapabilities. 
     292    """ 
     293 
     294    def __init__(self, elem): 
     295        self.name = elem.find('ContactPersonPrimary/ContactPerson').text 
     296        self.organization = elem.find('ContactPersonPrimary/ContactOrganization').text 
     297        address = elem.find('ContactAddress') 
     298        if address is not None: 
     299            try:     
     300                self.address = address.find('Address').text 
     301                self.city = address.find('City').text 
     302                self.region = address.find('StateOrProvince').text 
     303                self.postcode = address.find('Postcode').text 
     304                self.country = address.find('Country').text 
     305            except: pass 
     306        self.email = elem.find('ContactElectronicMailAddress').text  
     307 
    283308 
    284309# Deprecated classes follow 
  • OWSLib/trunk/tests/JPLCapabilities.txt

    r511 r602  
    1414    >>> wms.capabilities.service 
    1515    'OGC:WMS' 
     16    >>> wms.capabilities.versions 
     17    ['1.1.1'] 
    1618    >>> wms.capabilities.title 
    1719    'JPL Global Imagery Service' 
     20    >>> wms.capabilities.abstract 
     21    '' 
     22    >>> wms.capabilities.link 
     23    'http://' 
     24    >>> wms.capabilities.keywords 
     25    [] 
     26    >>> wms.capabilities.access 
     27    {'fees': '', 'constraints': ''} 
     28    >>> wms.capabilities.provider 
     29    {'name': 'x', 'link': '', 'email': ''} 
    1830     
    1931Test available content layers 
  • OWSLib/trunk/tests/MapServerWFSCapabilities.txt

    r515 r602  
    1313    >>> wfs.capabilities.service 
    1414    'MapServer WFS' 
     15    >>> wfs.capabilities.versions 
     16    ['1.1.1'] 
    1517    >>> wfs.capabilities.title 
    1618    'Bird Studies Canada WMS/WFS Server' 
     19    >>> wfs.capabilities.abstract 
     20    '' 
     21    >>> wfs.capabilities.link 
     22    'http://' 
     23    >>> wfs.capabilities.keywords 
     24    [] 
     25    >>> wfs.capabilities.access 
     26    {'fees': '', 'constraints': ''} 
     27    >>> wfs.capabilities.provider 
     28    {'name': 'x', 'link': '', 'email': ''} 
    1729     
    1830Test available content layers