udata 6.1.7.dev25937__py2.py3-none-any.whl → 6.1.7.dev25970__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of udata might be problematic. Click here for more details.

@@ -35,6 +35,12 @@ KNOWN_PAGINATION = (
35
35
  (HYDRA.PagedCollection, HYDRA.nextPage)
36
36
  )
37
37
 
38
+ # Useful to patch essential failing URIs
39
+ URIS_TO_REPLACE = {
40
+ # See https://github.com/etalab/data.gouv.fr/issues/1151
41
+ 'https://project-open-data.cio.gov/v1.1/schema/catalog.jsonld': 'https://gist.githubusercontent.com/maudetes/f019586185d6f59dcfb07f97148a1973/raw/585c3c7bf602b5a4e635b137257d0619792e2c1f/gistfile1.txt' # noqa
42
+ }
43
+
38
44
 
39
45
  def extract_graph(source, target, node, specs):
40
46
  for p, o in source.predicate_objects(node):
@@ -80,7 +86,10 @@ class DcatBackend(BaseBackend):
80
86
  page = 0
81
87
  while url:
82
88
  subgraph = Graph(namespace_manager=namespace_manager)
83
- subgraph.parse(data=requests.get(url).text, format=fmt)
89
+ data = requests.get(url).text
90
+ for old_uri, new_uri in URIS_TO_REPLACE.items():
91
+ data = data.replace(old_uri, new_uri)
92
+ subgraph.parse(data=data, format=fmt)
84
93
 
85
94
  url = None
86
95
  for cls, prop in KNOWN_PAGINATION:
@@ -10,6 +10,7 @@ from udata.core.organization.factories import OrganizationFactory
10
10
  from udata.core.dataset.factories import LicenseFactory
11
11
 
12
12
  from .factories import HarvestSourceFactory
13
+ from ..backends.dcat import URIS_TO_REPLACE
13
14
  from .. import actions
14
15
 
15
16
  log = logging.getLogger(__name__)
@@ -333,7 +334,7 @@ class DcatBackendTest:
333
334
  assert 'geodesy' in dataset.tags # support dcat:theme
334
335
  assert dataset.license.id == 'fr-lo'
335
336
  assert len(dataset.resources) == 1
336
- assert dataset.description.startswith('Data from the \'National network')
337
+ assert dataset.description.startswith("Data from the 'National network")
337
338
  assert dataset.harvest is not None
338
339
  assert dataset.harvest.dct_identifier == '0437a976-cff1-4fa6-807a-c23006df2f8f'
339
340
  assert dataset.harvest.remote_id == '0437a976-cff1-4fa6-807a-c23006df2f8f'
@@ -383,3 +384,27 @@ class DcatBackendTest:
383
384
  error = job.errors[0]
384
385
  expected = 'Unable to detect format from extension or mime type'
385
386
  assert error.message == expected
387
+
388
+ def test_use_replaced_uris(self, rmock, mocker):
389
+ mocker.patch.dict(
390
+ URIS_TO_REPLACE,
391
+ {'http://example.org/this-url-does-not-exist': 'https://json-ld.org/contexts/person.jsonld'}
392
+ )
393
+ url = DCAT_URL_PATTERN.format(path='', domain=TEST_DOMAIN)
394
+ rmock.get(url, json={
395
+ '@context': 'http://example.org/this-url-does-not-exist',
396
+ '@type': 'dcat:Catalog',
397
+ 'dataset': []
398
+ })
399
+ rmock.head(url, headers={'Content-Type': 'application/json'})
400
+ org = OrganizationFactory()
401
+ source = HarvestSourceFactory(backend='dcat',
402
+ url=url,
403
+ organization=org)
404
+ actions.run(source.slug)
405
+
406
+ source.reload()
407
+
408
+ job = source.get_last_job()
409
+ assert len(job.items) == 0
410
+ assert job.status == 'done'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: udata
3
- Version: 6.1.7.dev25937
3
+ Version: 6.1.7.dev25970
4
4
  Summary: Open data portal
5
5
  Home-page: https://github.com/opendatateam/udata
6
6
  Author: Opendata Team
@@ -142,6 +142,7 @@ It is collectively taken care of by members of the
142
142
  - Add `business_number_id` metadata for organizations [#2871](https://github.com/opendatateam/udata/pull/2871)
143
143
  - Return 403 when posting comment on discussion closed [#2881](https://github.com/opendatateam/udata/pull/2881)
144
144
  - Ensure rdf parsed frequency is lowercase [#2883](https://github.com/opendatateam/udata/pull/2883)
145
+ - Add a dict of URIs to replace in a RDF graph at harvest time [#2884](https://github.com/opendatateam/udata/pull/2884)
145
146
 
146
147
  ## 6.1.6 (2023-07-19)
147
148
 
@@ -248,13 +248,13 @@ udata/harvest/signals.py,sha256=wlXTi1E7rIVyNvxw0yUqyN5gF3thg276LAOmAF9vDJY,1338
248
248
  udata/harvest/tasks.py,sha256=3KkHuyFzGrjoBvLoT1V1VPJooyOIbv2Ze9QSXXWJ0ec,1949
249
249
  udata/harvest/backends/__init__.py,sha256=qcLhHKWO97TeWd93ZwymG_Cc9FO7sMM7h4fs6XYdtS8,447
250
250
  udata/harvest/backends/base.py,sha256=q0cA38RI_U07JaY69DDEE_31lPGI4sfFPyFupkwy9ks,11888
251
- udata/harvest/backends/dcat.py,sha256=a0wsLzvcUEnxH13-zTVEbeaEvMUCAJoYnBiFFppCzhI,4031
251
+ udata/harvest/backends/dcat.py,sha256=4V9uBocONeUGfvHqzWtoG2kTkBUYBE4_S-N5NLGEyR8,4509
252
252
  udata/harvest/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
253
253
  udata/harvest/tests/factories.py,sha256=l1FRbM6-iblzIm4HDwQ23EnmoSDguQFGN4l_ygzSdGY,1981
254
254
  udata/harvest/tests/test_actions.py,sha256=7xSpouCAcf5p_bd38zHCyPN7sKWUUZXA7IlpI-yNVrQ,27603
255
255
  udata/harvest/tests/test_api.py,sha256=QXhseHfnkBEmMbIJzroMdDYGLDj6Njal1s-2sn0xhEM,14888
256
256
  udata/harvest/tests/test_base_backend.py,sha256=JA8Df1Eu-lEPLZfxyK81bsmT6exOjV_3PtKHJekAp5g,12092
257
- udata/harvest/tests/test_dcat_backend.py,sha256=C-0XS-yFL_3OF_1YkLmjjGPfVbc6T1jJ8ydIqKuD06o,15248
257
+ udata/harvest/tests/test_dcat_backend.py,sha256=TzEIbUvbsQ3vJHzDxBunH0-G17xK9sb_p5cuIb9e0VU,16186
258
258
  udata/harvest/tests/test_filters.py,sha256=V2HFZlexIJa6r1DX6g2ktvIgjg4gSY11QPfPOd3_Oug,2370
259
259
  udata/harvest/tests/test_models.py,sha256=Wh2_Bwvfdrj0Fsh8Q8j4yTfLwmYv5WiGbGhrvf6zbII,905
260
260
  udata/harvest/tests/test_notifications.py,sha256=ZwtwioittW3XcZc0x6zbHjs1dVaAxPytlVymnJa5w0E,817
@@ -621,9 +621,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=QA_9yeYr22WR-o8T-Aix_78FJ0TBab
621
621
  udata/translations/pt/LC_MESSAGES/udata.po,sha256=VLs_Q8RFHBn6Cw8w9r7BAgop_XBk9QwprZVObuzx1_g,41327
622
622
  udata/translations/sr/LC_MESSAGES/udata.mo,sha256=k_WnQxuJkopM1eWzKJFOok_OAWOjZhSLlB3O_ggzv3U,29086
623
623
  udata/translations/sr/LC_MESSAGES/udata.po,sha256=xJJpHjSGJbpuKhVO8AhdDdbL6F7ILmWqJkz-6-fCgu4,48168
624
- udata-6.1.7.dev25937.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
625
- udata-6.1.7.dev25937.dist-info/METADATA,sha256=_F1xyYpMQuyMQhyVy5dKSsXzIpp6BcZJ1gnSRNumIyI,109082
626
- udata-6.1.7.dev25937.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
627
- udata-6.1.7.dev25937.dist-info/entry_points.txt,sha256=XACUgLu26a0tcYEoS6v8Av8yA-LSsH1XwB5AEM4jOPg,330
628
- udata-6.1.7.dev25937.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
629
- udata-6.1.7.dev25937.dist-info/RECORD,,
624
+ udata-6.1.7.dev25970.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
625
+ udata-6.1.7.dev25970.dist-info/METADATA,sha256=ucpePQHWzY5gt3hR5ySqRdanoFYYCV24pMi5U8XZgWM,109202
626
+ udata-6.1.7.dev25970.dist-info/WHEEL,sha256=iYlv5fX357PQyRT2o6tw1bN-YcKFFHKqB_LwHO5wP-g,110
627
+ udata-6.1.7.dev25970.dist-info/entry_points.txt,sha256=XACUgLu26a0tcYEoS6v8Av8yA-LSsH1XwB5AEM4jOPg,330
628
+ udata-6.1.7.dev25970.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
629
+ udata-6.1.7.dev25970.dist-info/RECORD,,