[Git][debian-gis-team/pywps][master] 4 commits: New upstream version 4.2.9

Bas Couwenberg gitlab at salsa.debian.org
Sat Dec 12 06:24:59 GMT 2020



Bas Couwenberg pushed to branch master at Debian GIS Project / pywps


Commits:
63f29e3b by Bas Couwenberg at 2020-12-12T07:14:59+01:00
New upstream version 4.2.9
- - - - -
0cd01e61 by Bas Couwenberg at 2020-12-12T07:15:01+01:00
Update upstream source from tag 'upstream/4.2.9'

Update to upstream version '4.2.9'
with Debian dir a327914f5bd03f5ec91d60940c83175013ab1e94
- - - - -
7d6667b3 by Bas Couwenberg at 2020-12-12T07:16:36+01:00
New upstream release.

- - - - -
b36eff54 by Bas Couwenberg at 2020-12-12T07:17:38+01:00
Set distribution to unstable.

- - - - -


10 changed files:

- VERSION.txt
- debian/changelog
- pywps/__init__.py
- pywps/app/Service.py
- pywps/app/WPSRequest.py
- pywps/inout/basic.py
- pywps/inout/inputs.py
- pywps/templates/1.0.0/execute/main.xml
- tests/test_execute.py
- tests/test_inout.py


Changes:

=====================================
VERSION.txt
=====================================
@@ -1 +1 @@
-4.2.8
+4.2.9


=====================================
debian/changelog
=====================================
@@ -1,9 +1,10 @@
-pywps (4.2.8-2) UNRELEASED; urgency=medium
+pywps (4.2.9-1) unstable; urgency=medium
 
+  * New upstream release.
   * Bump watch file version to 4.
   * Bump Standards-Version to 4.5.1, no changes.
 
- -- Bas Couwenberg <sebastic at debian.org>  Fri, 06 Nov 2020 19:55:51 +0100
+ -- Bas Couwenberg <sebastic at debian.org>  Sat, 12 Dec 2020 07:17:26 +0100
 
 pywps (4.2.8-1) unstable; urgency=medium
 


=====================================
pywps/__init__.py
=====================================
@@ -9,7 +9,7 @@ import os
 
 from lxml.builder import ElementMaker
 
-__version__ = '4.2.8'
+__version__ = '4.2.9'
 
 LOGGER = logging.getLogger('PYWPS')
 LOGGER.debug('setting core variables')


=====================================
pywps/app/Service.py
=====================================
@@ -270,10 +270,12 @@ class Service(object):
 
         outinputs = deque(maxlen=source.max_occurs)
 
-        for datainput in inputs:
+        for inpt in inputs:
             newinpt = source.clone()
-            newinpt.data = [datainput.minx, datainput.miny,
-                            datainput.maxx, datainput.maxy]
+            newinpt.data = inpt.get('data')
+            LOGGER.debug(f'newinpt bbox data={newinpt.data}')
+            newinpt.crs = inpt.get('crs')
+            newinpt.dimensions = inpt.get('dimensions')
             outinputs.append(newinpt)
 
         if len(outinputs) < source.min_occurs:


=====================================
pywps/app/WPSRequest.py
=====================================
@@ -450,10 +450,15 @@ def get_inputs_from_xml(doc):
         bbox_datas = xpath_ns(input_el, './wps:Data/wps:BoundingBoxData')
         if bbox_datas:
             for bbox_data in bbox_datas:
-                bbox_data_el = bbox_data
-                bbox = BoundingBox(bbox_data_el)
-                the_inputs[identifier].append(bbox)
-                LOGGER.debug("parse bbox: {},{},{},{}".format(bbox.minx, bbox.miny, bbox.maxx, bbox.maxy))
+                bbox = BoundingBox(bbox_data)
+                LOGGER.debug("parse bbox: minx={}, miny={}, maxx={},maxy={}".format(
+                    bbox.minx, bbox.miny, bbox.maxx, bbox.maxy))
+                inpt = {}
+                inpt['identifier'] = identifier_el.text
+                inpt['data'] = [bbox.minx, bbox.miny, bbox.maxx, bbox.maxy]
+                inpt['crs'] = bbox.crs
+                inpt['dimensions'] = bbox.dimensions
+                the_inputs[identifier].append(inpt)
     return the_inputs
 
 


=====================================
pywps/inout/basic.py
=====================================
@@ -677,22 +677,34 @@ class BasicBoundingBox(object):
     """
 
     def __init__(self, crss=None, dimensions=2):
+        self._data = None
         self.crss = crss or ['epsg:4326']
         self.crs = self.crss[0]
         self.dimensions = dimensions
 
+    @property
+    def data(self):
+        return self._data
+
+    @data.setter
+    def data(self, value):
+        if isinstance(value, list):
+            self._data = [float(number) for number in value]
+        elif isinstance(value, str):
+            self._data = [float(number) for number in value.split(',')[:4]]
+        else:
+            self._data = None
+
     @property
     def ll(self):
-        data = getattr(self, 'data', None)
-        if data:
-            return data[:2]
+        if self.data:
+            return self.data[:2]
         return []
 
     @property
     def ur(self):
-        data = getattr(self, 'data', None)
-        if data:
-            return data[2:]
+        if self.data:
+            return self.data[2:]
         return []
 
 


=====================================
pywps/inout/inputs.py
=====================================
@@ -3,6 +3,7 @@
 # licensed under MIT, Please consult LICENSE.txt for details     #
 ##################################################################
 
+import re
 import lxml.etree as etree
 import six
 
@@ -14,6 +15,8 @@ from copy import deepcopy
 from pywps.validator.mode import MODE
 from pywps.inout.literaltypes import AnyValue, NoValue, ValuesReference, AllowedValue
 
+CDATA_PATTERN = re.compile(r'<!\[CDATA\[(.*?)\]\]>')
+
 
 class BoundingBoxInput(basic.BBoxInput):
 
@@ -214,7 +217,12 @@ class ComplexInput(basic.ComplexInput):
         elif json_input.get('href'):
             instance.url = json_input['href']
         elif json_input.get('data'):
-            instance.data = json_input['data']
+            data = json_input['data']
+            # remove cdata tag if it exists (issue #553)
+            match = CDATA_PATTERN.match(data)
+            if match:
+                data = match.group(1)
+            instance.data = data
 
         return instance
 


=====================================
pywps/templates/1.0.0/execute/main.xml
=====================================
@@ -48,17 +48,10 @@
 			</wps:Data>
             {% elif input.type == "bbox" %}
 			<wps:Data>
-                {% if input.crs == "EPSG:4326" %}
-                <ows:WGS84BoundingBox dimensions="{{ input.dimensions }}">
+                <wps:BoundingBoxData crs="{{ input.crs }}" dimensions="{{ input.dimensions }}">
                     <ows:LowerCorner>{% for c in input.ll %} {{ c }} {% endfor %}</ows:LowerCorner>
                     <ows:UpperCorner>{% for c in input.ur %} {{ c }} {% endfor %}</ows:UpperCorner>
-                </ows:WGS84BoundingBox>
-                {% else %}
-                <ows:BoundingBox crs="{{ input.crs }}" dimensions="{{ input.dimensions }}">
-                    <ows:LowerCorner>{% for c in input.ll %} {{ c }} {% endfor %}</ows:LowerCorner>
-                    <ows:UpperCorner>{% for c in input.ur %} {{ c }} {% endfor %}</ows:UpperCorner>
-                </ows:BoundingBox>
-                {% endif %}
+                </wps:BoundingBoxData>
 			</wps:Data>
             {% elif input.type == "reference" %}
             <wps:Reference xlink:href="{{ input.href }}" method="{{ input.method }}" mimeType="{{ input.mimetype }}" encoding="{{ input.encoding }}" schema="{{ input.schema }}"/>
@@ -102,17 +95,10 @@
 			</wps:Data>
             {% elif output.type == "bbox" %}
 			<wps:Data>
-                    {% if output.crs == "EPSG:4326" %}
-                    <ows:WGS84BoundingBox dimensions="{{ output.dimensions }}">
-                        <ows:LowerCorner>{% for c in output.ll %} {{ c }} {% endfor %}</ows:LowerCorner>
-                        <ows:UpperCorner>{% for c in output.ur %} {{ c }} {% endfor %}</ows:UpperCorner>
-                    </ows:WGS84BoundingBox>
-                    {% else %}
-                    <ows:BoundingBox crs="{{ output.crs }}" dimensions="{{ output.dimensions }}">
+                    <wps:BoundingBoxData crs="{{ output.crs }}" dimensions="{{ output.dimensions }}">
                         <ows:LowerCorner>{% for c in output.ll %} {{ c }} {% endfor %}</ows:LowerCorner>
                         <ows:UpperCorner>{% for c in output.ur %} {{ c }} {% endfor %}</ows:UpperCorner>
-                    </ows:BoundingBox>
-                    {% endif %}
+                    </wps:BoundingBoxData>
 			</wps:Data>
             {% endif %}
 		</wps:Output>


=====================================
tests/test_execute.py
=====================================
@@ -105,7 +105,7 @@ def create_bbox_process():
         coords = request.inputs['mybbox'][0].data
         assert isinstance(coords, list)
         assert len(coords) == 4
-        assert coords[0] == '15'
+        assert coords[0] == 15.0
         response.outputs['outbbox'].data = coords
         return response
 
@@ -459,8 +459,8 @@ class ExecuteTest(unittest.TestCase):
                 WPS.Input(
                     OWS.Identifier('mybbox'),
                     WPS.Data(WPS.BoundingBoxData(
-                        OWS.LowerCorner('15 50'),
-                        OWS.UpperCorner('16 51'),
+                        OWS.LowerCorner('15.0 50.0'),
+                        OWS.UpperCorner('16.0 51.0'),
                     ))
                 )
             ),
@@ -475,13 +475,13 @@ class ExecuteTest(unittest.TestCase):
             output,
             './ows:Identifier')[0].text)
 
-        lower_corner = xpath_ns(output, './wps:Data/ows:WGS84BoundingBox/ows:LowerCorner')[0].text
+        lower_corner = xpath_ns(output, './wps:Data/wps:BoundingBoxData/ows:LowerCorner')[0].text
         lower_corner = lower_corner.strip().replace('  ', ' ')
-        self.assertEqual('15 50', lower_corner)
+        self.assertEqual('15.0 50.0', lower_corner)
 
-        upper_corner = xpath_ns(output, './wps:Data/ows:WGS84BoundingBox/ows:UpperCorner')[0].text
+        upper_corner = xpath_ns(output, './wps:Data/wps:BoundingBoxData/ows:UpperCorner')[0].text
         upper_corner = upper_corner.strip().replace('  ', ' ')
-        self.assertEqual('16 51', upper_corner)
+        self.assertEqual('16.0 51.0', upper_corner)
 
     def test_output_response_dataType(self):
         client = client_for(Service(processes=[create_greeter()]))


=====================================
tests/test_inout.py
=====================================
@@ -288,9 +288,10 @@ class SerializationComplexInputTest(unittest.TestCase):
     def test_complex_input_data(self):
         complex = self.make_complex_input()
         complex.data = "some data"
+        # the data is enclosed by a CDATA tag in json
+        assert complex.json['data'] == '<![CDATA[some data]]>'
+        # dump to json and load it again
         complex2 = inout.inputs.ComplexInput.from_json(complex.json)
-        # the data is enclosed by a CDATA tag
-        complex._data = u'<![CDATA[{}]]>'.format(complex.data)
         # it's expected that the file path changed
         complex._file = complex2.file
 
@@ -299,14 +300,14 @@ class SerializationComplexInputTest(unittest.TestCase):
 
     def test_complex_input_stream(self):
         complex = self.make_complex_input()
-        complex.stream = StringIO("some data")
+        complex.stream = StringIO("{'name': 'test', 'input1': ']]'}")
+        # the data is enclosed by a CDATA tag in json
+        assert complex.json['data'] == "<![CDATA[{'name': 'test', 'input1': ']]'}]]>"
+        # dump to json and load it again
         complex2 = inout.inputs.ComplexInput.from_json(complex.json)
-
         # the serialized stream becomes a data type
         # we hard-code it for the testing comparison
         complex.prop = 'data'
-        # the data is enclosed by a CDATA tag
-        complex._data = u'<![CDATA[{}]]>'.format(complex.data)
         # it's expected that the file path changed
         complex._file = complex2.file
 
@@ -381,18 +382,18 @@ class SerializationBoundingBoxInputTest(unittest.TestCase):
 
     def make_bbox_input(self):
         bbox = inout.inputs.BoundingBoxInput(
-            identifier="complexinput",
-            title='MyComplex',
+            identifier="bbox",
+            title='BBox',
             crss=['epsg:3857', 'epsg:4326'],
             abstract="some description",
             keywords=['kw1', 'kw2'],
             dimensions=2,
             workdir=self.tmp_dir,
-            metadata=[Metadata("special data")],
+            metadata=[Metadata("bbox")],
             min_occurs=2,
             max_occurs=5,
             mode=MODE.NONE,
-            default="something else",
+            default="0,50,20,70",
             default_type=SOURCE_TYPE.DATA,
         )
         bbox.as_reference = False
@@ -411,7 +412,6 @@ class SerializationBoundingBoxInputTest(unittest.TestCase):
         self.assertEqual(bbox_1.max_occurs, bbox_2.max_occurs)
         self.assertEqual(bbox_1.valid_mode, bbox_2.valid_mode)
         self.assertEqual(bbox_1.as_reference, bbox_2.as_reference)
-
         self.assertEqual(bbox_1.ll, bbox_2.ll)
         self.assertEqual(bbox_1.ur, bbox_2.ur)
 
@@ -683,8 +683,8 @@ class LiteralOutputTest(unittest.TestCase):
     def setUp(self):
 
         self.literal_output = inout.outputs.LiteralOutput(
-            "literaloutput", 
-            data_type="integer", 
+            "literaloutput",
+            data_type="integer",
             title="Literal Output",
             translations={"fr-CA": {"title": "Mon output", "abstract": "Une description"}},
         )
@@ -715,8 +715,8 @@ class BBoxInputTest(unittest.TestCase):
     def setUp(self):
 
         self.bbox_input = inout.inputs.BoundingBoxInput(
-            "bboxinput", 
-            title="BBox input", 
+            "bboxinput",
+            title="BBox input",
             dimensions=2,
             translations={"fr-CA": {"title": "Mon input", "abstract": "Une description"}},
         )



View it on GitLab: https://salsa.debian.org/debian-gis-team/pywps/-/compare/840577908852eb53a188e5665f2e72c754f4b957...b36eff5498d1177b5c1e9e1a03bfc7931184c860

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/pywps/-/compare/840577908852eb53a188e5665f2e72c754f4b957...b36eff5498d1177b5c1e9e1a03bfc7931184c860
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20201212/6e930a33/attachment-0001.html>


More information about the Pkg-grass-devel mailing list