[owslib] 01/01: New upstream version 0.16.0

Johan Van de Wauw johanvdw-guest at moszumanska.debian.org
Fri Dec 22 11:44:53 UTC 2017


This is an automated email from the git hooks/post-receive script.

johanvdw-guest pushed a commit to branch upstream
in repository owslib.

commit 0862b90406d3c2fee63d688e3d8163390c80cc63
Author: Johan Van de Wauw <johan at gisky.be>
Date:   Fri Dec 22 11:56:50 2017 +0100

    New upstream version 0.16.0
---
 .travis.yml                |   1 -
 VERSION.txt                |   2 +-
 etc/debian/control         |   6 +-
 owslib/__init__.py         |   2 +-
 owslib/crs.py              |   6 +-
 owslib/csw.py              |   6 +-
 owslib/etree.py            |  46 +++--------
 owslib/feature/__init__.py |   8 +-
 owslib/feature/schema.py   |   8 +-
 owslib/feature/wfs100.py   |   2 +-
 owslib/feature/wfs110.py   |  13 ++-
 owslib/feature/wfs200.py   |  11 ++-
 owslib/iso.py              | 192 ++++++++++++++++++++++++++++++++++++++++++++-
 owslib/iso_che.py          |  10 +--
 owslib/namespaces.py       |   4 +-
 owslib/util.py             |  28 +------
 requirements-2.6.txt       |   1 -
 setup.py                   |   3 -
 tests/doctests/crs.txt     |   5 ++
 tests/doctests/iso_che.txt |   2 +
 tox.ini                    |  22 +-----
 21 files changed, 268 insertions(+), 110 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index a28b025..1f85961 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,6 @@ env:
 install:
   - pip install -r requirements.txt
   - pip install -r requirements-dev.txt
-  - if [ "$TRAVIS_PYTHON_VERSION" == "2.6" ]; then pip install -r requirements-2.6.txt; fi
   - if [ "$LXML" == "true" ]; then pip install lxml; fi
 script:
   - python -m pytest
diff --git a/VERSION.txt b/VERSION.txt
index a551051..04a373e 100644
--- a/VERSION.txt
+++ b/VERSION.txt
@@ -1 +1 @@
-0.15.0
+0.16.0
diff --git a/etc/debian/control b/etc/debian/control
index 71f387c..aa4cd5d 100644
--- a/etc/debian/control
+++ b/etc/debian/control
@@ -2,12 +2,12 @@ Source: owslib
 Section: python
 Priority: optional
 Maintainer: Angelos Tzotsos <gcpp.kalxas at gmail.com>
-Build-Depends: debhelper (>= 7.0.50), python-setuptools (>= 0.6), python-support (>=0.6), python-all-dev (>= 2.3.5-11), python (>= 2.6.6-3)
+Build-Depends: debhelper (>= 7.0.50), python-setuptools (>= 0.6), python-support (>=0.6), python-all-dev (>= 2.3.5-11), python (>= 2.7)
 Standards-Version: 3.9.3
-X-Python-Version: >= 2.5
+X-Python-Version: >= 2.7
 Homepage: http://geopython.github.com/OWSLib/
 
 Package: python-owslib
 Architecture: all
-Depends: ${misc:Depends}, debconf, python (>=2.5), python-lxml
+Depends: ${misc:Depends}, debconf, python (>=2.7), python-lxml
 Description: OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service (hence OWS) interface standards, and their related content models.
diff --git a/owslib/__init__.py b/owslib/__init__.py
index 219c087..1755f42 100644
--- a/owslib/__init__.py
+++ b/owslib/__init__.py
@@ -1,3 +1,3 @@
 from __future__ import (absolute_import, division, print_function)
 
-__version__ = '0.15.0'
+__version__ = '0.16.0'
diff --git a/owslib/crs.py b/owslib/crs.py
index 2c77cfd..052458c 100644
--- a/owslib/crs.py
+++ b/owslib/crs.py
@@ -1783,7 +1783,11 @@ class Crs(object):
         elif len(values) == 2:  # it's an authority:code code
             self.encoding = "code"
             self.authority = values[0].upper()
-            self.code = int(values[1])
+
+            try:
+                self.code = int(values[1])
+            except:
+                self.code = values[1]
 
         # if the user has not forced the axisorder,
         # scan the list of codes that have an axis ordering of
diff --git a/owslib/csw.py b/owslib/csw.py
index 8847328..b12f236 100644
--- a/owslib/csw.py
+++ b/owslib/csw.py
@@ -30,7 +30,7 @@ from owslib.etree import etree
 from owslib import fes
 from owslib import util
 from owslib import ows
-from owslib.iso import MD_Metadata
+from owslib.iso import MD_Metadata, FC_FeatureCatalogue
 from owslib.fgdc import Metadata
 from owslib.dif import DIF
 from owslib.gm03 import GM03
@@ -547,6 +547,9 @@ class CatalogueServiceWeb(object):
                 val = i.find(util.nspath_eval('gmd:fileIdentifier/gco:CharacterString', namespaces))
                 identifier = self._setidentifierkey(util.testXMLValue(val))
                 self.records[identifier] = MD_Metadata(i)
+            for i in self._exml.findall('.//'+util.nspath_eval('gfc:FC_FeatureCatalogue', namespaces)):
+                identifier = self._setidentifierkey(util.testXMLValue(i.attrib['uuid'], attrib=True))
+                self.records[identifier] = FC_FeatureCatalogue(i)
         elif outputschema == namespaces['fgdc']: # fgdc csdgm
             for i in self._exml.findall('.//metadata'):
                 val = i.find('idinfo/datasetid')
@@ -667,6 +670,7 @@ class CatalogueServiceWeb(object):
                     # of typenames
                     ns_keys = [x.split(':')[0] for x in ns.split(' ')]
                     self.request = add_namespaces(self.request, ns_keys)
+            self.request = add_namespaces(self.request, 'ows')
 
             self.request = util.element_to_string(self.request, encoding='utf-8')
 
diff --git a/owslib/etree.py b/owslib/etree.py
index b8babe8..0dd3334 100644
--- a/owslib/etree.py
+++ b/owslib/etree.py
@@ -6,61 +6,37 @@
 
 from __future__ import (absolute_import, division, print_function)
 import six
-import inspect
+from owslib.namespaces import Namespaces
+
 
 def patch_well_known_namespaces(etree_module):
+    """Monkey patches the etree module to add some well-known namespaces."""
 
-    import warnings
-    from owslib.namespaces import Namespaces
     ns = Namespaces()
 
-    """Monkey patches the etree module to add some well-known namespaces."""
-
     try:
         register_namespace = etree_module.register_namespace
     except AttributeError:
-        try:
-            etree_module._namespace_map
+        etree_module._namespace_map
 
-            def register_namespace(prefix, uri):
-                etree_module._namespace_map[uri] = prefix
-        except AttributeError:
-            def register_namespace(prefix, uri):
-                pass
-            warnings.warn("Only 'lxml.etree' >= 2.3 and 'xml.etree.ElementTree' >= 1.3 are fully supported!")
+        def register_namespace(prefix, uri):
+            etree_module._namespace_map[uri] = prefix
 
     for k, v in six.iteritems(ns.get_namespaces()):
         register_namespace(k, v)
 
+
 # try to find lxml or elementtree
 try:
     from lxml import etree
     from lxml.etree import ParseError
     ElementType = etree._Element
 except ImportError:
+    import xml.etree.ElementTree as etree
+    ElementType = etree.Element
     try:
-        # Python 2.x/3.x with ElementTree included
-        import xml.etree.ElementTree as etree
-
-        try:
-            from xml.etree.ElementTree import ParseError
-        except ImportError:
-            from xml.parsers.expat import ExpatError as ParseError
-
-        if hasattr(etree, 'Element') and inspect.isclass(etree.Element):
-            # python 3.4, 3.3, 2.7
-            ElementType = etree.Element
-        else:
-            # python 2.6
-            ElementType = etree._ElementInterface
-
+        from xml.etree.ElementTree import ParseError
     except ImportError:
-        try:
-            # Python < 2.5 with ElementTree installed
-            import elementtree.ElementTree as etree
-            ParseError = StandardError      # i can't find a ParseError related item in elementtree docs!
-            ElementType = etree.Element
-        except ImportError:
-            raise RuntimeError('You need either lxml or ElementTree to use OWSLib!')
+        from xml.parsers.expat import ExpatError as ParseError
 
 patch_well_known_namespaces(etree)
diff --git a/owslib/feature/__init__.py b/owslib/feature/__init__.py
index 28ba7d8..ecb20e4 100644
--- a/owslib/feature/__init__.py
+++ b/owslib/feature/__init__.py
@@ -82,7 +82,7 @@ class WebFeatureService_(object):
 
     def getGETGetFeatureRequest(self, typename=None, filter=None, bbox=None, featureid=None,
                    featureversion=None, propertyname=None, maxfeatures=None,storedQueryID=None, storedQueryParams=None,
-                   outputFormat=None, method='Get', startindex=None):
+                   outputFormat=None, method='Get', startindex=None, sortby=None):
         """Formulate proper GetFeature request using KVP encoding
         ----------
         typename : list
@@ -105,6 +105,10 @@ class WebFeatureService_(object):
             Requested response format of the request.
         startindex: int (optional)
             Start position to return feature set (paging in combination with maxfeatures)
+        sortby: list (optional)
+            List of property names whose values should be used to order
+            (upon presentation) the set of feature instances that
+            satify the query.
 
         There are 3 different modes of use
 
@@ -134,6 +138,8 @@ class WebFeatureService_(object):
                 request['typename'] = ','.join(typename)
         if propertyname: 
             request['propertyname'] = ','.join(propertyname)
+        if sortby:
+            request['sortby'] = ','.join(sortby)
         if featureversion: 
             request['featureversion'] = str(featureversion)
         if maxfeatures: 
diff --git a/owslib/feature/schema.py b/owslib/feature/schema.py
index 8a8561e..cf29322 100644
--- a/owslib/feature/schema.py
+++ b/owslib/feature/schema.py
@@ -26,7 +26,7 @@ GML_NAMESPACES = (MYNS.get_namespace('gml'),
                   MYNS.get_namespace('gml32'))
 
 
-def get_schema(url, typename, version='1.0.0', timeout=30):
+def get_schema(url, typename, version='1.0.0', timeout=30, username=None, password=None):
     """Parses DescribeFeatureType response and creates schema compatible
     with :class:`fiona`
 
@@ -37,8 +37,11 @@ def get_schema(url, typename, version='1.0.0', timeout=30):
     """
 
     url = _get_describefeaturetype_url(url, version, typename)
-    res = openURL(url, timeout=timeout)
+    res = openURL(url, timeout=timeout, username=username, password=password)
     root = etree.fromstring(res.read())
+
+    if ':' in typename:
+        typename = typename.split(':')[1]
     type_element = findall(root, '{%s}element' % XS_NAMESPACE,
                            attribute_name='name', attribute_value=typename)[0]
     complex_type = type_element.attrib['type'].split(":")[1]
@@ -142,4 +145,3 @@ def _get_describefeaturetype_url(url, version, typename):
 
     urlqs = urlencode(tuple(query_string))
     return url.split('?')[0] + '?' + urlqs
-
diff --git a/owslib/feature/wfs100.py b/owslib/feature/wfs100.py
index 43cfe96..43c3f9a 100644
--- a/owslib/feature/wfs100.py
+++ b/owslib/feature/wfs100.py
@@ -152,7 +152,7 @@ class WebFeatureService_1_0_0(object):
         """
         Helper method to make sure the StringIO being returned will work.
 
-        Differences between Python 2.6/2.7/3.x mean we have a lot of cases to handle.
+        Differences between Python 2.7/3.x mean we have a lot of cases to handle.
         """
         if PY2:
             return StringIO(strval)
diff --git a/owslib/feature/wfs110.py b/owslib/feature/wfs110.py
index 5d35569..9a6b7a4 100644
--- a/owslib/feature/wfs110.py
+++ b/owslib/feature/wfs110.py
@@ -141,7 +141,7 @@ class WebFeatureService_1_1_0(WebFeatureService_):
         """
         Helper method to make sure the StringIO being returned will work.
 
-        Differences between Python 2.6/2.7/3.x mean we have a lot of cases to handle.
+        Differences between Python 2.7/3.x mean we have a lot of cases to handle.
         """
         if PY2:
             return StringIO(strval)
@@ -151,7 +151,7 @@ class WebFeatureService_1_1_0(WebFeatureService_):
     def getfeature(self, typename=None, filter=None, bbox=None, featureid=None,
                    featureversion=None, propertyname='*', maxfeatures=None,
                    srsname=None, outputFormat=None, method='Get',
-                   startindex=None):
+                   startindex=None, sortby=None):
         """Request and return feature data as a file-like object.
 
         Parameters
@@ -178,6 +178,10 @@ class WebFeatureService_1_1_0(WebFeatureService_):
             Requested response format of the request.
         startindex: int (optional)
             Start position to return feature set (paging in combination with maxfeatures)
+        sortby: list (optional)
+            List of property names whose values should be used to order
+            (upon presentation) the set of feature instances that
+            satify the query.
 
         There are 3 different modes of use
 
@@ -228,6 +232,11 @@ class WebFeatureService_1_1_0(WebFeatureService_):
                 propertyname = [propertyname]
             request['propertyname'] = ','.join(propertyname)
 
+        if sortby is not None:
+            if not isinstance(sortby, list):
+                sortby = [sortby]
+            request['sortby'] = ','.join(sortby)
+
         if featureversion is not None:
             request['featureversion'] = str(featureversion)
         if maxfeatures is not None:
diff --git a/owslib/feature/wfs200.py b/owslib/feature/wfs200.py
index 8153583..12f2425 100644
--- a/owslib/feature/wfs200.py
+++ b/owslib/feature/wfs200.py
@@ -160,7 +160,7 @@ class WebFeatureService_2_0_0(WebFeatureService_):
         """
         Helper method to make sure the StringIO being returned will work.
 
-        Differences between Python 2.6/2.7/3.x mean we have a lot of cases to handle.
+        Differences between Python 2.7/3.x mean we have a lot of cases to handle.
         """
         if PY2:
             return StringIO(strval)
@@ -169,7 +169,7 @@ class WebFeatureService_2_0_0(WebFeatureService_):
 
     def getfeature(self, typename=None, filter=None, bbox=None, featureid=None,
                    featureversion=None, propertyname=None, maxfeatures=None,storedQueryID=None, storedQueryParams=None,
-                   method='Get', outputFormat=None, startindex=None):
+                   method='Get', outputFormat=None, startindex=None, sortby=None):
         """Request and return feature data as a file-like object.
         #TODO: NOTE: have changed property name from ['*'] to None - check the use of this in WFS 2.0
         Parameters
@@ -194,6 +194,10 @@ class WebFeatureService_2_0_0(WebFeatureService_):
             Requested response format of the request.
         startindex: int (optional)
             Start position to return feature set (paging in combination with maxfeatures)
+        sortby: list (optional)
+            List of property names whose values should be used to order
+            (upon presentation) the set of feature instances that
+            satify the query.
 
         There are 3 different modes of use
 
@@ -209,7 +213,8 @@ class WebFeatureService_2_0_0(WebFeatureService_):
             (url) = self.getGETGetFeatureRequest(typename, filter, bbox, featureid,
                                                  featureversion, propertyname,
                                                  maxfeatures, storedQueryID,
-                                                 storedQueryParams, outputFormat, 'Get', startindex)
+                                                 storedQueryParams, outputFormat, 'Get',
+                                                 startindex, sortby)
             if log.isEnabledFor(logging.DEBUG):
                 log.debug('GetFeature WFS GET url %s'% url)
         else:
diff --git a/owslib/iso.py b/owslib/iso.py
index fbd855b..db294fd 100644
--- a/owslib/iso.py
+++ b/owslib/iso.py
@@ -20,7 +20,7 @@ from owslib.namespaces import Namespaces
 # default variables
 def get_namespaces():
     n = Namespaces()
-    ns = n.get_namespaces(["gco","gmd","gml","gml32","gmx","gts","srv","xlink"])
+    ns = n.get_namespaces(["gco","gfc","gmd","gml","gml32","gmx","gts","srv","xlink"])
     ns[None] = n.get_namespace("gmd")
     return ns
 namespaces = get_namespaces()
@@ -49,6 +49,7 @@ class MD_Metadata(object):
             self.identification = None
             self.serviceidentification = None
             self.identificationinfo = []
+            self.contentinfo = []
             self.distribution = None
             self.dataquality = None
         else:
@@ -140,6 +141,10 @@ class MD_Metadata(object):
                     elif tagval == 'SV_ServiceIdentification':
                         self.identificationinfo.append(SV_ServiceIdentification(val))
 
+            self.contentinfo = []
+            for contentinfo in md.findall(util.nspath_eval('gmd:contentInfo/gmd:MD_FeatureCatalogueDescription', namespaces)):
+                self.contentinfo.append(MD_FeatureCatalogueDescription(contentinfo))
+
             val = md.find(util.nspath_eval('gmd:distributionInfo/gmd:MD_Distribution', namespaces))
 
             if val is not None:
@@ -256,7 +261,6 @@ class CI_ResponsibleParty(object):
 
             self.role = _testCodeListValue(md.find(util.nspath_eval('gmd:role/gmd:CI_RoleCode', namespaces)))
 
-
 class MD_Keywords(object):
     """
     Class for the metadata MD_Keywords element
@@ -907,3 +911,187 @@ class CodelistCatalogue(object):
             return ids
         else:
             return None
+
+class MD_FeatureCatalogueDescription(object):
+    """Process gmd:MD_FeatureCatalogueDescription"""
+    def __init__(self, fcd=None):
+        if fcd is None:
+            self.xml = None
+            self.compliancecode = None
+            self.language = []
+            self.includedwithdataset = None
+            self.featuretypenames = []
+            self.featurecatalogues = []
+        else:
+            if hasattr(fcd, 'getroot'):  # standalone document
+                self.xml = etree.tostring(fcd.getroot())
+            else:  # part of a larger document
+                self.xml = etree.tostring(fcd)
+
+            self.compliancecode = None
+            val = fcd.find(util.nspath_eval('gmd:complianceCode/gco:Boolean', namespaces))
+            val = util.testXMLValue(val)
+            if val is not None:
+                self.compliancecode = util.getTypedValue('boolean', val)
+
+            self.language = []
+            for i in fcd.findall(util.nspath_eval('gmd:language/gco:CharacterString', namespaces)):
+                val = util.testXMLValue(i)
+                if val is not None:
+                    self.language.append(val)
+
+            self.includedwithdataset = None
+            val = fcd.find(util.nspath_eval('gmd:includedWithDataset/gco:Boolean', namespaces))
+            val = util.testXMLValue(val)
+            if val is not None:
+                self.includedwithdataset = util.getTypedValue('boolean', val)
+
+            self.featuretypenames = []
+            for i in fcd.findall(util.nspath_eval('gmd:featureTypes/gco:LocalName', namespaces)):
+                val = util.testXMLValue(i)
+                if val is not None:
+                    self.featuretypenames.append(val)
+            for i in fcd.findall(util.nspath_eval('gmd:featureTypes/gco:ScopedName', namespaces)):
+                val = util.testXMLValue(i)
+                if val is not None:
+                    self.featuretypenames.append(val)
+
+            self.featurecatalogues = []
+            for i in fcd.findall(util.nspath_eval('gmd:featureCatalogueCitation', namespaces)):
+                val = i.attrib['uuidref']
+                val = util.testXMLValue(val, attrib=True)
+                if val is not None:
+                    self.featurecatalogues.append(val)
+
+class FC_FeatureCatalogue(object):
+    """Process gfc:FC_FeatureCatalogue"""
+    def __init__(self, fc=None):
+        if fc is None:
+            self.xml = None
+            self.identifier = None
+            self.name = None
+            self.versiondate = None
+            self.producer = None
+            self.featuretypes = []
+        else:
+            if hasattr(fc, 'getroot'):  # standalone document
+                self.xml = etree.tostring(fc.getroot())
+            else:  # part of a larger document
+                self.xml = etree.tostring(fc)
+
+            val = fc.attrib['uuid']
+            self.identifier = util.testXMLValue(val, attrib=True)
+
+            val = fc.find(util.nspath_eval('gmx:name/gco:CharacterString', namespaces))
+            self.name = util.testXMLValue(val)
+
+            val = fc.find(util.nspath_eval('gmx:versionDate/gco:Date', namespaces))
+            self.versiondate = util.testXMLValue(val)
+
+            if not self.versiondate:
+                val = fc.find(util.nspath_eval('gmx:versionDate/gco:DateTime', namespaces))
+                self.versiondate = util.testXMLValue(val)
+
+            self.producer = None
+            prod = fc.find(util.nspath_eval('gfc:producer/gmd:CI_ResponsibleParty', namespaces))
+            if prod is not None:
+                self.producer = CI_ResponsibleParty(prod)
+
+            self.featuretypes = []
+            for i in fc.findall(util.nspath_eval('gfc:featureType/gfc:FC_FeatureType', namespaces)):
+                self.featuretypes.append(FC_FeatureType(i))
+
+class FC_FeatureType(object):
+    """Process gfc:FC_FeatureType"""
+    def __init__(self, ft=None):
+        if ft is None:
+            self.xml = None
+            self.identifier = None
+            self.typename = None
+            self.definition = None
+            self.isabstract = None
+            self.aliases = []
+            self.attributes = []
+        else:
+            if hasattr(ft, 'getroot'):  # standalone document
+                self.xml = etree.tostring(ft.getroot())
+            else:  # part of a larger document
+                self.xml = etree.tostring(ft)
+
+            val = ft.attrib['uuid']
+            self.identifier = util.testXMLValue(val, attrib=True)
+
+            val = ft.find(util.nspath_eval('gfc:typeName/gco:LocalName', namespaces))
+            self.typename = util.testXMLValue(val)
+
+            val = ft.find(util.nspath_eval('gfc:definition/gco:CharacterString', namespaces))
+            self.definition = util.testXMLValue(val)
+
+            self.isabstract = None
+            val = ft.find(util.nspath_eval('gfc:isAbstract/gco:Boolean', namespaces))
+            val = util.testXMLValue(val)
+            if val is not None:
+                self.isabstract = util.getTypedValue('boolean', val)
+
+            self.aliases = []
+            for i in ft.findall(util.nspath_eval('gfc:aliases/gco:LocalName', namespaces)):
+                self.aliases.append(util.testXMLValue(i))
+
+            self.attributes = []
+            for i in ft.findall(util.nspath_eval('gfc:carrierOfCharacteristics/gfc:FC_FeatureAttribute', namespaces)):
+                self.attributes.append(FC_FeatureAttribute(i))
+
+class FC_FeatureAttribute(object):
+    """Process gfc:FC_FeatureAttribute"""
+    def __init__(self, fa=None):
+        if fa is None:
+            self.xml = None
+            self.membername = None
+            self.definition = None
+            self.code = None
+            self.valuetype = None
+            self.listedvalues = []
+        else:
+            if hasattr(fa, 'getroot'):  # standalone document
+                self.xml = etree.tostring(fa.getroot())
+            else:  # part of a larger document
+                self.xml = etree.tostring(fa)
+
+            val = fa.find(util.nspath_eval('gfc:memberName/gco:LocalName', namespaces))
+            self.membername = util.testXMLValue(val)
+
+            val = fa.find(util.nspath_eval('gfc:definition/gco:CharacterString', namespaces))
+            self.definition = util.testXMLValue(val)
+
+            val = fa.find(util.nspath_eval('gfc:code/gco:CharacterString', namespaces))
+            self.code = util.testXMLValue(val)
+
+            val = fa.find(util.nspath_eval('gfc:valueType/gco:TypeName/gco:aName/gco:CharacterString', namespaces))
+            self.valuetype = util.testXMLValue(val)
+
+            self.listedvalues = []
+            for i in fa.findall(util.nspath_eval('gfc:listedValue/gfc:FC_ListedValue', namespaces)):
+                self.listedvalues.append(FC_ListedValue(i))
+
+class FC_ListedValue(object):
+    """Process gfc:FC_ListedValue"""
+    def __init__(self, lv=None):
+        if lv is None:
+            self.xml = None
+            self.label = None
+            self.code = None
+            self.definition = None
+        else:
+            if hasattr(lv, 'getroot'):  # standalone document
+                self.xml = etree.tostring(lv.getroot())
+            else:  # part of a larger document
+                self.xml = etree.tostring(lv)
+
+            val = lv.find(util.nspath_eval('gfc:label/gco:CharacterString', namespaces))
+            self.label = util.testXMLValue(val)
+
+            val = lv.find(util.nspath_eval('gfc:code/gco:CharacterString', namespaces))
+            self.code = util.testXMLValue(val)
+
+            val = lv.find(util.nspath_eval('gfc:definition/gco:CharacterString', namespaces))
+            self.definition = util.testXMLValue(val)
diff --git a/owslib/iso_che.py b/owslib/iso_che.py
index bc8b53b..f08779f 100644
--- a/owslib/iso_che.py
+++ b/owslib/iso_che.py
@@ -539,11 +539,11 @@ class MD_DataIdentification(object):
             extents.extend(md.findall(util.nspath_eval('srv:extent', namespaces)))
             for extent in extents:
                 if val is None:
-                    for e in extent.findall(util.nspath_eval('gmd:EX_Extent/gmd:geographicElement', namespaces)):
-                        if e.find(util.nspath_eval('gmd:EX_GeographicBoundingBox', namespaces)) is not None or e.find(util.nspath_eval('gmd:EX_BoundingPolygon', namespaces)) is not None:
-                            val = e
-                            break
-                    self.extent = EX_Extent(val)
+                    for e_ in extent.findall(util.nspath_eval('gmd:EX_Extent/gmd:geographicElement', namespaces)):
+                        if e_.find(util.nspath_eval('gmd:EX_GeographicBoundingBox', namespaces)) is not None or e_.find(util.nspath_eval('gmd:EX_BoundingPolygon', namespaces)) is not None:
+                            self.extent = EX_Extent(e_)
+                            if self.extent.boundingBox is not None:
+                                break
                     self.bbox = self.extent.boundingBox  # for backwards compatibility
 
                 if val2 is None:
diff --git a/owslib/namespaces.py b/owslib/namespaces.py
index fa0484f..2136e9b 100644
--- a/owslib/namespaces.py
+++ b/owslib/namespaces.py
@@ -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',
+        'gfc'   :   'http://www.isotc211.org/2005/gfc',
         'gm03'  :   'http://www.interlis.ch/INTERLIS2.3',
         'gmd'   :   'http://www.isotc211.org/2005/gmd',
         'gmi'   :   'http://www.isotc211.org/2005/gmi',
@@ -58,7 +59,8 @@ class Namespaces(object):
         'xlink' :   'http://www.w3.org/1999/xlink',
         'xs'    :   'http://www.w3.org/2001/XMLSchema',
         'xs2'   :   'http://www.w3.org/XML/Schema',
-        'xsi'   :   'http://www.w3.org/2001/XMLSchema-instance'
+        'xsi'   :   'http://www.w3.org/2001/XMLSchema-instance',
+        'wml2'  :   'http://www.opengis.net/waterml/2.0'
     }    
 
     def get_namespace(self, key):
diff --git a/owslib/util.py b/owslib/util.py
index 206b1ed..38e1230 100644
--- a/owslib/util.py
+++ b/owslib/util.py
@@ -10,6 +10,7 @@
 from __future__ import (absolute_import, division, print_function)
 
 import sys
+from collections import OrderedDict
 from dateutil import parser
 from datetime import datetime
 import pytz
@@ -634,13 +635,6 @@ except AttributeError:
 log = logging.getLogger('owslib')
 log.addHandler(NullHandler())
 
-# OrderedDict
-try:  # 2.7
-    from collections import OrderedDict
-except:  # 2.6
-    from ordereddict import OrderedDict
-
-
 def which_etree():
     """decipher which etree library is being used by OWSLib"""
 
@@ -668,23 +662,9 @@ def findall(root, xpath, attribute_name=None, attribute_value=None):
 
     found_elements = []
 
-
-    # python 2.6 < does not support complicated XPATH expressions used lower
-    if (2, 6) == sys.version_info[0:2] and which_etree() != 'lxml.etree':
-
-        elements = root.getiterator(xpath)
-
-        if attribute_name is not None and attribute_value is not None:
-            for element in elements:
-                if element.attrib.get(attribute_name) == attribute_value:
-                    found_elements.append(element)
-        else:
-            found_elements = elements
-    # python at least 2.7 and/or lxml can do things much simplier
-    else:
-        if attribute_name is not None and attribute_value is not None:
-            xpath = '%s[@%s="%s"]' % (xpath, attribute_name, attribute_value)
-        found_elements = root.findall('.//' + xpath)
+    if attribute_name is not None and attribute_value is not None:
+        xpath = '%s[@%s="%s"]' % (xpath, attribute_name, attribute_value)
+    found_elements = root.findall('.//' + xpath)
 
     if found_elements == []:
         found_elements = None
diff --git a/requirements-2.6.txt b/requirements-2.6.txt
deleted file mode 100644
index 591279c..0000000
--- a/requirements-2.6.txt
+++ /dev/null
@@ -1 +0,0 @@
-ordereddict==1.1
diff --git a/setup.py b/setup.py
index a316d64..297f199 100644
--- a/setup.py
+++ b/setup.py
@@ -17,9 +17,6 @@ class PyTest(TestCommand):
 readme = open('README.txt').read()
 reqs = [line.strip() for line in open('requirements.txt')]
 
-if sys.version[:3] < '2.7':
-    reqs += [line.strip() for line in open('requirements-2.6.txt')]
-
 setup(name              = 'OWSLib',
       version           = owslib.__version__,
       description       = 'OGC Web Service utility library',
diff --git a/tests/doctests/crs.txt b/tests/doctests/crs.txt
index ed246c5..574f157 100644
--- a/tests/doctests/crs.txt
+++ b/tests/doctests/crs.txt
@@ -33,3 +33,8 @@
     4326
     >>> c.axisorder
     'yx'
+    >>> c=crs.Crs('PROJ4:+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000')
+    >>> c.authority
+    'PROJ4'
+    >>> c.code
+    '+proj=lcc +lat_1=46.8 +lat_0=46.8 +lon_0=0 +k_0=0.99987742 +x_0=600000 +y_0=2200000'
\ No newline at end of file
diff --git a/tests/doctests/iso_che.txt b/tests/doctests/iso_che.txt
index c18db22..2b89504 100644
--- a/tests/doctests/iso_che.txt
+++ b/tests/doctests/iso_che.txt
@@ -14,6 +14,8 @@
     u'Gew\xe4sserschutzkarte'
     >>> m.identification.contact[0].organization
     u'Amt f\xfcr Umweltschutz'
+    >>> m.identification.bbox.minx
+    8.396
     >>> m.contact[0].organization
     'Grundbuch- und Vermessungsamt'
     >>> m.contact[0].streetname
diff --git a/tox.ini b/tox.ini
index 8dd4d27..f9cc297 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,7 +6,7 @@ python_functions=check
 
 [tox]
 skipsdist=True
-envlist=py27-with-lxml,py27-with-old-lxml,py27-without-lxml,py26-with-lxml,py26-with-old-lxml,py26-without-lxml
+envlist=py27-with-lxml,py27-with-old-lxml,py27-without-lxml
 
 [testenv:py27-with-lxml]
 basepython = /opt/python-2.7.6/bin/python
@@ -25,26 +25,6 @@ basepython = /opt/python-2.7.6/bin/python
 deps=-rrequirements.txt
      -rrequirements-dev.txt
 
-[testenv:py26-with-lxml]
-basepython = /opt/python-2.6.9/bin/python
-deps=-rrequirements.txt
-     -rrequirements-dev.txt
-     -rrequirements-2.6.txt
-     lxml
-
-[testenv:py26-with-old-lxml]
-basepython = /opt/python-2.6.9/bin/python
-deps=-rrequirements.txt
-     -rrequirements-dev.txt
-     -rrequirements-2.6.txt
-     lxml<2.3
-
-[testenv:py26-without-lxml]
-basepython = /opt/python-2.6.9/bin/python
-deps=-rrequirements.txt
-     -rrequirements-dev.txt
-     -rrequirements-2.6.txt
-
 [testenv]
 recreate=False
 commands=

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/owslib.git



More information about the Pkg-grass-devel mailing list