geopython / pycsw

pycsw is an OGC CSW server implementation written in Python. pycsw fully implements the OpenGIS Catalogue Service Implementation Specification [Catalogue Service for the Web]. Initial development started in 2010 (more formally announced in 2011). The project is certified OGC Compliant, and is an OGC Reference Implementation. pycsw allows for the publishing and discovery of geospatial metadata via numerous APIs (CSW 2/CSW 3, OpenSearch, OAI-PMH, SRU). Existing repositories of geospatial metadata can also be exposed, providing a standards-based metadata and catalogue component of spatial data infrastructures. pycsw is Open Source, released under an MIT license, and runs on all major platforms (Windows, Linux, Mac OS X). Please read the docs at https://pycsw.org/docs for more information.
https://pycsw.org
MIT License
197 stars 153 forks source link

Exception on /csw, postalcode should be configured as string, not int #951

Open pvgenuchten opened 5 months ago

pvgenuchten commented 5 months ago

Description

not sure what's happening here, 'll check asap, maybe a bad config?

[2024-02-01T21:46:04Z] {/usr/lib/python3/dist-packages/flask/app.py:1890} ERROR - Exception on /csw [GET] Traceback (most recent call last): File "/usr/lib/python3/dist-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3/dist-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3/dist-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3/dist-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/lib/python3/dist-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3/dist-packages/flask/app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "/home/pycsw/pycsw/pycsw/wsgi_flask.py", line 264, in csw status, headers, content = application_dispatcher(request.environ) File "/home/pycsw/pycsw/pycsw/wsgi.py", line 84, in application_dispatcher status, contents = csw.dispatch_wsgi() File "/home/pycsw/pycsw/pycsw/server.py", line 248, in dispatch_wsgi return self.dispatch() File "/home/pycsw/pycsw/pycsw/server.py", line 567, in dispatch self.response = self.iface.getcapabilities() File "/home/pycsw/pycsw/pycsw/ogc/csw/csw3.py", line 259, in getcapabilities etree.SubElement(address, File "src/lxml/etree.pyx", line 1024, in lxml.etree._Element.text.set File "src/lxml/apihelpers.pxi", line 747, in lxml.etree._setNodeText File "src/lxml/apihelpers.pxi", line 735, in lxml.etree._createTextNode File "src/lxml/apihelpers.pxi", line 1538, in lxml.etree._utf8 TypeError: Argument must be bytes or unicode, got 'int'

pvgenuchten commented 5 months ago

The issue seems related to the config of postalcode

the error occurs if configured as:

    postalcode: 6700

No error if configured as

    postalcode: "6708 PB"

Expected: both config cases should work fine