udata 9.1.5.dev31495__py2.py3-none-any.whl → 9.1.5.dev31504__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.

@@ -40,16 +40,10 @@ def serialize_resource_for_event(resource):
40
40
 
41
41
  @task(route="high.resource")
42
42
  def publish(url, document, resource_id, action):
43
- match action:
44
- case EventMessageType.CREATED:
45
- method = requests.post
46
- resource = serialize_resource_for_event(get_by(document.resources, "id", resource_id))
47
- case EventMessageType.MODIFIED:
48
- method = requests.put
49
- resource = serialize_resource_for_event(get_by(document.resources, "id", resource_id))
50
- case EventMessageType.DELETED:
51
- method = requests.delete
52
- resource = None
43
+ if action == EventMessageType.DELETED:
44
+ resource = None
45
+ else:
46
+ resource = serialize_resource_for_event(get_by(document.resources, "id", resource_id))
53
47
  payload = {
54
48
  "resource_id": str(resource_id),
55
49
  "dataset_id": str(document.id),
@@ -58,7 +52,7 @@ def publish(url, document, resource_id, action):
58
52
  headers = {}
59
53
  if current_app.config["RESOURCES_ANALYSER_API_KEY"]:
60
54
  headers = {"Authorization": f"Bearer {current_app.config['RESOURCES_ANALYSER_API_KEY']}"}
61
- r = method(url, json=payload, headers=headers)
55
+ r = requests.post(url, json=payload, headers=headers)
62
56
  r.raise_for_status()
63
57
 
64
58
 
@@ -68,7 +62,7 @@ def publish_added_resource_message(sender, document, **kwargs):
68
62
  "RESOURCES_ANALYSER_URI"
69
63
  ):
70
64
  publish.delay(
71
- f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resources/",
65
+ f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resource/created/",
72
66
  document,
73
67
  kwargs["resource_id"],
74
68
  EventMessageType.CREATED,
@@ -81,7 +75,7 @@ def publish_updated_resource_message(sender, document, **kwargs):
81
75
  "RESOURCES_ANALYSER_URI"
82
76
  ):
83
77
  publish.delay(
84
- f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resources/",
78
+ f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resource/updated/",
85
79
  document,
86
80
  kwargs["resource_id"],
87
81
  EventMessageType.MODIFIED,
@@ -94,7 +88,7 @@ def publish_removed_resource_message(sender, document, **kwargs):
94
88
  "RESOURCES_ANALYSER_URI"
95
89
  ):
96
90
  publish.delay(
97
- f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resources/",
91
+ f"{current_app.config.get('RESOURCES_ANALYSER_URI')}/api/resource/deleted/",
98
92
  document,
99
93
  kwargs["resource_id"],
100
94
  EventMessageType.DELETED,
@@ -31,7 +31,7 @@ class DatasetEventsTest:
31
31
  }
32
32
 
33
33
  mock_req.assert_called_with(
34
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
34
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/created/",
35
35
  json=expected_value,
36
36
  headers={}, # No RESOURCES_ANALYSER_API_KEY, no headers.
37
37
  )
@@ -53,12 +53,12 @@ class DatasetEventsTest:
53
53
  dataset.add_resource(resource)
54
54
 
55
55
  mock_req.assert_called_with(
56
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
56
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/created/",
57
57
  json=expected_value,
58
58
  headers={"Authorization": "Bearer foobar-api-key"},
59
59
  )
60
60
 
61
- @patch("requests.put")
61
+ @patch("requests.post")
62
62
  @pytest.mark.options(RESOURCES_ANALYSER_API_KEY="foobar-api-key")
63
63
  def test_publish_message_resource_modified(self, mock_req):
64
64
  resource = ResourceFactory(schema=Schema(url="http://localhost/my-schema"))
@@ -77,7 +77,7 @@ class DatasetEventsTest:
77
77
  dataset.update_resource(resource)
78
78
 
79
79
  mock_req.assert_called_with(
80
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
80
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/updated/",
81
81
  json=expected_value,
82
82
  headers={"Authorization": "Bearer foobar-api-key"},
83
83
  )
@@ -87,7 +87,7 @@ class DatasetEventsTest:
87
87
  # (for example, encoding Embeds fails)
88
88
  complexjson.dumps(expected_value)
89
89
 
90
- @patch("requests.delete")
90
+ @patch("requests.post")
91
91
  @pytest.mark.options(RESOURCES_ANALYSER_API_KEY="foobar-api-key")
92
92
  def test_publish_message_resource_removed(self, mock_req):
93
93
  resource = ResourceFactory()
@@ -104,7 +104,7 @@ class DatasetEventsTest:
104
104
  dataset.remove_resource(resource)
105
105
 
106
106
  mock_req.assert_called_with(
107
- f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resources/",
107
+ f"{current_app.config['RESOURCES_ANALYSER_URI']}/api/resource/deleted/",
108
108
  json=expected_value,
109
109
  headers={"Authorization": "Bearer foobar-api-key"},
110
110
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: udata
3
- Version: 9.1.5.dev31495
3
+ Version: 9.1.5.dev31504
4
4
  Summary: Open data portal
5
5
  Home-page: https://github.com/opendatateam/udata
6
6
  Author: Opendata Team
@@ -147,7 +147,6 @@ It is collectively taken care of by members of the
147
147
  - Fix the boolean filters in the API for the "new system" endpoints [#3139](https://github.com/opendatateam/udata/pull/3139)
148
148
  - Update authlib dependency from 0.14.3 to 1.3.1 [#3135](https://github.com/opendatateam/udata/pull/3135)
149
149
  - Add CORS on resource redirect [#3145](https://github.com/opendatateam/udata/pull/3145)
150
- - Use hydra's RESTful endpoint URLs [#3142](https://github.com/opendatateam/udata/pull/3142)
151
150
 
152
151
  ## 9.1.4 (2024-08-26)
153
152
 
@@ -95,7 +95,7 @@ udata/core/dataset/apiv2.py,sha256=VTE4eYx5udzOdHDUkD7TYpuCtppZMKp1okTSEE1fcgI,1
95
95
  udata/core/dataset/commands.py,sha256=__hPAk_6iHtgMnEG51ux0vbNWJHxUjXhi1ukH4hF5jY,3714
96
96
  udata/core/dataset/constants.py,sha256=pkOvrdNBq3k1ojJcv6oSg7kK1IUtb3PqLni-YJ3rKSY,2880
97
97
  udata/core/dataset/csv.py,sha256=XMl8MaYCEyGmkCZqRSWrGRxCht2C9e3aQYGwDQLXYT0,3618
98
- udata/core/dataset/events.py,sha256=LGSTwipns0H6141jaupLdEdrJhvcyhzL7yRUNBWWi9Q,3712
98
+ udata/core/dataset/events.py,sha256=LEL9_iMTZ0bZlli2TdkQtV8pCRbFQBd91Hqh_WCW84c,3444
99
99
  udata/core/dataset/exceptions.py,sha256=uKiayLSpSzsnLvClObS6hOO0qXEqvURKN7_w8eimQNU,498
100
100
  udata/core/dataset/factories.py,sha256=fRDWDlybR_ud4pDs1-ntWuYHKtV9LMHeBOBp2SmTT6M,9006
101
101
  udata/core/dataset/forms.py,sha256=H2oeAD8XckMugnwUcyuKv7o1Xq1rEIlLz9FtxujqbIE,6196
@@ -629,7 +629,7 @@ udata/tests/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
629
629
  udata/tests/dataset/test_csv_adapter.py,sha256=Bupsw2vmkZjFLAbVATSek-6M_WZRsidXNGd28UQRVdE,3444
630
630
  udata/tests/dataset/test_dataset_actions.py,sha256=bgDjVYjOvu3sX_FCTCzf2snZYSprsqor2nAhIVuokSs,722
631
631
  udata/tests/dataset/test_dataset_commands.py,sha256=zMPJG2wYwKBee2zI65kmboxf59Zqa84DDjT8V5wj9uo,801
632
- udata/tests/dataset/test_dataset_events.py,sha256=SYYvtK_YjPUoMzw44CfoVtXn5gOcc7i0PqApcwRZkOw,4007
632
+ udata/tests/dataset/test_dataset_events.py,sha256=JP-qC9wxaCFn4CLUI3WWCqiDinXgfaa5nF9j-YhB0iQ,4034
633
633
  udata/tests/dataset/test_dataset_model.py,sha256=oaqm7q3DwZa4GLCyv7rj3rvtBIKxdCf4wUQdYo1pOiU,29745
634
634
  udata/tests/dataset/test_dataset_rdf.py,sha256=EAUYrM2es4WFOcTh42j1h3CzYTW6p0JfYQddHdiLln8,30082
635
635
  udata/tests/dataset/test_dataset_tasks.py,sha256=rSafDjCiOyEb2_tVUDN4wqGylF6Yf9VNB769SLmxlwI,2283
@@ -697,9 +697,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=WpPzAqVd2Onv_kz45ULUySKPLrpjcc
697
697
  udata/translations/pt/LC_MESSAGES/udata.po,sha256=18Op9RUITewoDRewlOdYzzq6gjsf1lsvepACV1d7zxs,44976
698
698
  udata/translations/sr/LC_MESSAGES/udata.mo,sha256=NIYRNhVoETZUvIvWm3cCW7DtMBAnS2vXzZjMF5ZzD_c,28500
699
699
  udata/translations/sr/LC_MESSAGES/udata.po,sha256=rQB-4V4WJ7bURj6g2j653vItr5TMHadcLQxec7_fDmg,51545
700
- udata-9.1.5.dev31495.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
701
- udata-9.1.5.dev31495.dist-info/METADATA,sha256=ySd09BEXqrXb4wN45fBm6uOU9cZPVNDgQnVfYqDD2e8,130735
702
- udata-9.1.5.dev31495.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
703
- udata-9.1.5.dev31495.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
704
- udata-9.1.5.dev31495.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
705
- udata-9.1.5.dev31495.dist-info/RECORD,,
700
+ udata-9.1.5.dev31504.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
701
+ udata-9.1.5.dev31504.dist-info/METADATA,sha256=Gb-WpN-DaXnNzJ7rQhx0kM687zUBsoa7TEqvBDDiuoM,130642
702
+ udata-9.1.5.dev31504.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
703
+ udata-9.1.5.dev31504.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
704
+ udata-9.1.5.dev31504.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
705
+ udata-9.1.5.dev31504.dist-info/RECORD,,