Skip to content

Commit

Permalink
Fix decoding error for new schema (#105)
Browse files Browse the repository at this point in the history
Fix decoding error, Set new version

Co-authored-by: Karsten Deininger <[email protected]>
  • Loading branch information
jwkaltz and kdeininger authored Jul 14, 2020
1 parent 76a9c45 commit b08999d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 4 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
Changelog
=========

1.5.3
-----

Supported geoLink schema versions: v1.0.0, v1.1.0, v1.1.1, v1.2.0 (default)

- Fix decoding error for schema version 1.2.0

1.5.2
-----

Expand Down
2 changes: 1 addition & 1 deletion geolink_formatter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from geolink_formatter.parser import XML


__version__ = '1.5.2'
__version__ = '1.5.3'


class GeoLinkFormatter(object):
Expand Down
9 changes: 7 additions & 2 deletions geolink_formatter/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import pkg_resources
import requests
import sys
from lxml.etree import XMLSchema, DTD, DocumentInvalid
from defusedxml.lxml import fromstring
from geolink_formatter.entity import Document, File
Expand Down Expand Up @@ -48,8 +49,12 @@ def __init__(self, host_url=None, version='1.2.0', dtd_validation=False, xsd_val
self._xsd_validation = xsd_validation
xsd = pkg_resources.resource_filename('geolink_formatter', 'schema/v{0}.xsd'.format(version))
if self._xsd_validation:
with open(xsd) as f:
self._schema = XMLSchema(fromstring(f.read()))
if sys.version_info.major > 2:
with open(xsd, encoding='utf-8') as f:
self._schema = XMLSchema(fromstring(f.read()))
else:
with open(xsd) as f:
self._schema = XMLSchema(fromstring(f.read()))

@property
def host_url(self):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]

setup(name='geolink_formatter',
version='1.5.2',
version='1.5.3',
description='OEREBlex geoLink Formatter',
license='BSD',
long_description='{readme}\n\n{changelog}'.format(readme=readme, changelog=changelog),
Expand Down

0 comments on commit b08999d

Please sign in to comment.