Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions owslib/namespaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class Namespaces(object):
'fes' : 'http://www.opengis.net/fes/2.0',
'fgdc' : 'http://www.opengis.net/cat/csw/csdgm',
'gco' : 'http://www.isotc211.org/2005/gco',
'georss': 'http://www.georss.org/georss',
'gm03' : 'http://www.interlis.ch/INTERLIS2.3',
'gmd' : 'http://www.isotc211.org/2005/gmd',
'gmi' : 'http://www.isotc211.org/2005/gmi',
Expand All @@ -31,6 +32,8 @@ class Namespaces(object):
'om10' : 'http://www.opengis.net/om/1.0',
'om100' : 'http://www.opengis.net/om/1.0',
'om20' : 'http://www.opengis.net/om/2.0',
'owc' : 'http://www.opengis.net/owc/1.0',
'owc10' : 'http://www.opengis.net/owc/1.0',
'ows' : 'http://www.opengis.net/ows',
'ows100': 'http://www.opengis.net/ows',
'ows110': 'http://www.opengis.net/ows/1.1',
Expand All @@ -55,6 +58,7 @@ class Namespaces(object):
'wms' : 'http://www.opengis.net/wms',
'wps' : 'http://www.opengis.net/wps/1.0.0',
'wps100': 'http://www.opengis.net/wps/1.0.0',
'wps200': 'http://www.opengis.net/wps/2.0',
'xlink' : 'http://www.w3.org/1999/xlink',
'xs' : 'http://www.w3.org/2001/XMLSchema',
'xs2' : 'http://www.w3.org/XML/Schema',
Expand Down
11 changes: 7 additions & 4 deletions owslib/ows.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,15 @@ def __init__(self,infoset,namespace=DEFAULT_OWS_NAMESPACE):
self.type = util.testXMLValue(val)
self.service=self.type #alternative? keep both?discuss

val = self._root.find(util.nspath('ServiceTypeVersion', namespace))
self.version = util.testXMLValue(val)
self.version = '0'
# Keep only the "highest" version string
for f in self._root.findall(util.nspath('ServiceTypeVersion', namespace)):
if f.text is not None and f.text > self.version:
self.version = f.text

self.profiles = []
for p in self._root.findall(util.nspath('Profile', namespace)):
self.profiles.append(util.testXMLValue(val))
for profile in self._root.findall(util.nspath('Profile', namespace)):
self.profiles.append(util.testXMLValue(profile))

class ServiceProvider(object):
"""Initialize an OWS Common ServiceProvider construct"""
Expand Down
10 changes: 6 additions & 4 deletions owslib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def openURL(url_base, data=None, method='Get', cookies=None, username=None, pass

if method.lower() == 'post':
try:
xml = etree.fromstring(data)
etree.fromstring(data)
headers['Content-Type'] = 'text/xml'
except (ParseError, UnicodeEncodeError):
pass
Expand Down Expand Up @@ -268,7 +268,7 @@ def add_namespaces(root, ns_keys):
existing_namespaces = set()
for elem in root.getiterator():
if elem.tag[0] == "{":
uri, tag = elem.tag[1:].split("}")
uri, _ = elem.tag[1:].split("}")
existing_namespaces.add(namespaces.get_namespace_from_url(uri))
for key, link in ns_keys:
if link is not None and key not in existing_namespaces:
Expand Down Expand Up @@ -490,8 +490,10 @@ def build_get_url(base_url, params):

def dump(obj, prefix=''):
'''Utility function to print to standard output a generic object with all its attributes.'''

print("%s %s.%s : %s" % (prefix, obj.__module__, obj.__class__.__name__, obj.__dict__))
try:
print("%s %s.%s : %s" % (prefix, obj.__module__, obj.__class__.__name__, obj.__dict__))
except AttributeError:
print("%s : %s" % (prefix, obj))

def getTypedValue(data_type, value):
'''Utility function to cast a string value to the appropriate XSD type. '''
Expand Down
Loading