udata 12.0.2.dev19__py3-none-any.whl → 13.0.1.dev1__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.
- udata/core/dataset/models.py +4 -1
- udata/harvest/backends/ckan/harvesters.py +0 -1
- udata/harvest/tests/ckan/test_dkan_backend.py +1 -1
- udata/migrations/2025-10-21-remove-ckan-harvest-modified-at.py +28 -0
- {udata-12.0.2.dev19.dist-info → udata-13.0.1.dev1.dist-info}/METADATA +1 -1
- {udata-12.0.2.dev19.dist-info → udata-13.0.1.dev1.dist-info}/RECORD +10 -9
- {udata-12.0.2.dev19.dist-info → udata-13.0.1.dev1.dist-info}/WHEEL +0 -0
- {udata-12.0.2.dev19.dist-info → udata-13.0.1.dev1.dist-info}/entry_points.txt +0 -0
- {udata-12.0.2.dev19.dist-info → udata-13.0.1.dev1.dist-info}/licenses/LICENSE +0 -0
- {udata-12.0.2.dev19.dist-info → udata-13.0.1.dev1.dist-info}/top_level.txt +0 -0
udata/core/dataset/models.py
CHANGED
|
@@ -780,10 +780,13 @@ class Dataset(Auditable, WithMetrics, DatasetBadgeMixin, Owned, Linkable, db.Doc
|
|
|
780
780
|
|
|
781
781
|
def compute_last_update(self):
|
|
782
782
|
"""
|
|
783
|
-
|
|
783
|
+
If dataset is harvested and its metadata contains a modified_at date, use it.
|
|
784
|
+
Else, use the more recent date we would have at the resource level (harvest, modified).
|
|
784
785
|
Default to dataset last_modified if no resource.
|
|
785
786
|
Resources should be fetched when calling this method.
|
|
786
787
|
"""
|
|
788
|
+
if self.harvest and self.harvest.modified_at:
|
|
789
|
+
return self.harvest.modified_at
|
|
787
790
|
if self.resources:
|
|
788
791
|
return max([res.last_modified for res in self.resources])
|
|
789
792
|
else:
|
|
@@ -158,7 +158,6 @@ class CkanBackend(BaseBackend):
|
|
|
158
158
|
dataset.tags = [t["name"] for t in data["tags"] if t["name"]]
|
|
159
159
|
|
|
160
160
|
dataset.harvest.created_at = data["metadata_created"]
|
|
161
|
-
dataset.harvest.modified_at = data["metadata_modified"]
|
|
162
161
|
|
|
163
162
|
dataset.harvest.ckan_name = data["name"]
|
|
164
163
|
|
|
@@ -51,6 +51,6 @@ class DkanBackendTest(PytestOnlyDBTestCase):
|
|
|
51
51
|
|
|
52
52
|
dataset = datasets.get(**{"harvest__remote_id": "04be6288-696d-4331-850d-a144871a7e3a"})
|
|
53
53
|
assert dataset.harvest.created_at == datetime(2019, 12, 10, 0, 0)
|
|
54
|
-
assert dataset.harvest.modified_at
|
|
54
|
+
assert dataset.harvest.modified_at is None
|
|
55
55
|
assert len(dataset.resources) == 2
|
|
56
56
|
assert "xlsx" in [r.format for r in dataset.resources]
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This migration empties harvest.modified_at field in the case of CKAN datasets.
|
|
3
|
+
Indeed, the value that was stored in this field was the *metadata* modification data
|
|
4
|
+
and not the *data* one, contrary to other backends.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
|
|
9
|
+
import click
|
|
10
|
+
|
|
11
|
+
from udata.core.dataset.models import Dataset
|
|
12
|
+
|
|
13
|
+
log = logging.getLogger(__name__)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def migrate(db):
|
|
17
|
+
datasets = Dataset.objects(harvest__backend="CKAN", harvest__modified_at__exists=True)
|
|
18
|
+
count = datasets.count()
|
|
19
|
+
|
|
20
|
+
with click.progressbar(datasets, length=count) as datasets:
|
|
21
|
+
for dataset in datasets:
|
|
22
|
+
dataset.harvest.modified_at = None
|
|
23
|
+
try:
|
|
24
|
+
dataset.save()
|
|
25
|
+
except Exception as err:
|
|
26
|
+
log.error(f"Cannot save dataset {dataset.id} {err}")
|
|
27
|
+
log.info(f"Updated {count} datasets")
|
|
28
|
+
log.info("Done")
|
|
@@ -103,7 +103,7 @@ udata/core/dataset/exceptions.py,sha256=uKiayLSpSzsnLvClObS6hOO0qXEqvURKN7_w8eim
|
|
|
103
103
|
udata/core/dataset/factories.py,sha256=tb18axsk8Tx5iUIqWM9IELdt-2Ryp2UN0-iY4fdea4U,9059
|
|
104
104
|
udata/core/dataset/forms.py,sha256=rd4M86QtRFa9laxJGAszgzzrcg4EBGrf-p3HwrxO80I,7126
|
|
105
105
|
udata/core/dataset/metrics.py,sha256=s8Xs_rqRXfNWsErkiJTuRMG5o_cU5iSK8mUJFKVSc7w,1204
|
|
106
|
-
udata/core/dataset/models.py,sha256=
|
|
106
|
+
udata/core/dataset/models.py,sha256=hS7gfjPEgFb13uBwupvvFrF_0gA2NzpF3_Uqgy-ZYFY,41816
|
|
107
107
|
udata/core/dataset/permissions.py,sha256=zXQ6kU-Ni3Pl5tDtat-ZPupug9InsNeCN7xRLc2Vcrc,1097
|
|
108
108
|
udata/core/dataset/preview.py,sha256=uFEpK-p5nIAlY8hVOMhd7mtkwFt6C_PQRMNxPvAyoo4,839
|
|
109
109
|
udata/core/dataset/rdf.py,sha256=jHyHgay3g3Z04Ju5kLyMk3Vyb-kWJYtqqg8Smamv7WI,32970
|
|
@@ -314,7 +314,7 @@ udata/harvest/backends/dcat.py,sha256=Qa4lRoLaTMRS9OFlCyKfQXGQ2rEQf0VomqzsL14L03
|
|
|
314
314
|
udata/harvest/backends/maaf.py,sha256=zplwjs9_Vafut6jXH-WPJNCJY0VjzDDc1ouQ0_zG3sI,8355
|
|
315
315
|
udata/harvest/backends/maaf.xsd,sha256=vEyG8Vqw7Yn_acjRdXjqUJgxOj4pv8bibep-FX-f3BQ,18322
|
|
316
316
|
udata/harvest/backends/ckan/__init__.py,sha256=JE7Qa7kX7Yd8OvmJnAO_NupZe0tqYyhhkgJ-iGNxX64,35
|
|
317
|
-
udata/harvest/backends/ckan/harvesters.py,sha256=
|
|
317
|
+
udata/harvest/backends/ckan/harvesters.py,sha256=tSy9yIhKjCjPhks17tM10_s9-ntueco9HUwpxWQKMzQ,10596
|
|
318
318
|
udata/harvest/backends/ckan/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
319
319
|
udata/harvest/backends/ckan/schemas/ckan.py,sha256=59VQoIxPBb5vOHFzzMtdnPcxHL4qNOTkPYa4cqn-7xQ,2353
|
|
320
320
|
udata/harvest/backends/ckan/schemas/dkan.py,sha256=RyQGPEaKqnunIrr9yApcz7WEfgye0IT1bV85wa2E8Lc,2774
|
|
@@ -333,7 +333,7 @@ udata/harvest/tests/ckan/conftest.py,sha256=SNIRJ7uh6ssIB56mwIdDgteHKUY040yX4gza
|
|
|
333
333
|
udata/harvest/tests/ckan/test_ckan_backend.py,sha256=R13q0lETLcNwBZt30TvFNaKJ1n2xjuUh5oJSpthV830,22216
|
|
334
334
|
udata/harvest/tests/ckan/test_ckan_backend_errors.py,sha256=1MBNxAno5cf9azYCrdXEdYeoVgGbxyHoLWuoooVumbU,4285
|
|
335
335
|
udata/harvest/tests/ckan/test_ckan_backend_filters.py,sha256=eohf2dnBl9WIqfSuQn0sT9jrMnjuoSbAMskdvn5w8G0,4287
|
|
336
|
-
udata/harvest/tests/ckan/test_dkan_backend.py,sha256=
|
|
336
|
+
udata/harvest/tests/ckan/test_dkan_backend.py,sha256=D-ww2Cv_vpANy8gG6m_k-E4ZhEJSMQtedqBAMHgaizI,2002
|
|
337
337
|
udata/harvest/tests/ckan/data/dkan-french-w-license.json,sha256=ud6wxyV3uvPSouY0-QB0qf88djamFW_WR6CbZzDCacs,7905
|
|
338
338
|
udata/harvest/tests/csw_dcat/XSLT.xml,sha256=vnJF2rom7oPVpzI9jwzwG6ek1TDXTY8GfbuQq_3vFxs,180475
|
|
339
339
|
udata/harvest/tests/csw_dcat/geo-ide_single-dataset.xml,sha256=WLaL46XspKW0ams4SJ4MiHLbDTNgPfTeolMYQrybbTg,42837
|
|
@@ -397,6 +397,7 @@ udata/migrations/2025-07-22-fix-duplicate-contact-points.py,sha256=ZEw2PX1E3jJiD
|
|
|
397
397
|
udata/migrations/2025-07-30-purge-old-harvest-dynamic-fields.py,sha256=ijeu6WvX6etOJrv0cEMCRJzj1pSetBguF-aUB1-2y_0,1017
|
|
398
398
|
udata/migrations/2025-09-04-update-legacy-frequencies.py,sha256=8YAROAHhytf6Kses_54aFscmPNes2aHRYqTwNpawdVk,1693
|
|
399
399
|
udata/migrations/2025-10-01-delete-orphaned-topic-elements.py,sha256=Mhx5ANOihZL4botxtjvfsll-xKBtkVQBkPcSq0BJ-Ec,788
|
|
400
|
+
udata/migrations/2025-10-21-remove-ckan-harvest-modified-at.py,sha256=85oGDAOLB7K9KzPRHHokc36EeMKLdWaOb3IkpwYkL3E,837
|
|
400
401
|
udata/migrations/__init__.py,sha256=RBCBDaTlLjuMs_Qzwji6Z6T4r7FCGXhESKoxQbT5qAA,11221
|
|
401
402
|
udata/models/__init__.py,sha256=RT0WaPKm2linlYnTmD0xck7M2XuIoIJ94E0ErzNGzaw,1418
|
|
402
403
|
udata/mongo/__init__.py,sha256=y4Rv-kq3o_kcEulcNpePLzocXPBNpx3Jd82G-VZPaMc,1421
|
|
@@ -623,9 +624,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=nv80xZLfIfUsSOMBcr29L268FDc_Gt
|
|
|
623
624
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=bUp-7Ray8t8ALgJk3Icw1jmiGIc9_pEJQHiGw_2EU2o,50989
|
|
624
625
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=Y_XpUxD074wXc63oJTnoVOyOQ2lmBxl-MrgluZ0Qdw4,27961
|
|
625
626
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=qh8mrz9AFuVQtXYSSP4QWsXLM_Lv3EHVifHT1NflWXY,57529
|
|
626
|
-
udata-
|
|
627
|
-
udata-
|
|
628
|
-
udata-
|
|
629
|
-
udata-
|
|
630
|
-
udata-
|
|
631
|
-
udata-
|
|
627
|
+
udata-13.0.1.dev1.dist-info/licenses/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
628
|
+
udata-13.0.1.dev1.dist-info/METADATA,sha256=e-UaqKtcE_I-X1LoSuH0ohiDmxiflC5_k3Lopa5PDHc,5173
|
|
629
|
+
udata-13.0.1.dev1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
630
|
+
udata-13.0.1.dev1.dist-info/entry_points.txt,sha256=v2u12qO11i2lyLNIp136WmLJ-NHT-Kew3Duu8J-AXPM,614
|
|
631
|
+
udata-13.0.1.dev1.dist-info/top_level.txt,sha256=EF6CE6YSHd_og-8LCEA4q25ALUpWVe8D0okOLdMAE3A,6
|
|
632
|
+
udata-13.0.1.dev1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|