udata 10.4.1.dev35191__py2.py3-none-any.whl → 10.4.1.dev35211__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.
- udata/core/dataset/apiv2.py +1 -1
- udata/core/dataset/csv.py +0 -1
- udata/core/dataset/models.py +0 -4
- udata/tests/api/test_datasets_api.py +24 -0
- udata/tests/dataset/test_csv_adapter.py +6 -3
- {udata-10.4.1.dev35191.dist-info → udata-10.4.1.dev35211.dist-info}/METADATA +3 -1
- {udata-10.4.1.dev35191.dist-info → udata-10.4.1.dev35211.dist-info}/RECORD +11 -11
- {udata-10.4.1.dev35191.dist-info → udata-10.4.1.dev35211.dist-info}/LICENSE +0 -0
- {udata-10.4.1.dev35191.dist-info → udata-10.4.1.dev35211.dist-info}/WHEEL +0 -0
- {udata-10.4.1.dev35191.dist-info → udata-10.4.1.dev35211.dist-info}/entry_points.txt +0 -0
- {udata-10.4.1.dev35191.dist-info → udata-10.4.1.dev35211.dist-info}/top_level.txt +0 -0
udata/core/dataset/apiv2.py
CHANGED
|
@@ -191,7 +191,7 @@ dataset_fields = apiv2.model(
|
|
|
191
191
|
spatial_coverage_fields, allow_null=True, description="The spatial coverage"
|
|
192
192
|
),
|
|
193
193
|
"license": fields.Raw(
|
|
194
|
-
attribute=lambda d: marshal(d.license, license_fields)
|
|
194
|
+
attribute=lambda d: marshal(d.license or DEFAULT_LICENSE, license_fields)
|
|
195
195
|
if request.headers.get(FULL_OBJECTS_HEADER, False, bool)
|
|
196
196
|
else (d.license.id if d.license is not None else None),
|
|
197
197
|
default=DEFAULT_LICENSE["id"],
|
udata/core/dataset/csv.py
CHANGED
|
@@ -40,7 +40,6 @@ class DatasetCsvAdapter(csv.Adapter):
|
|
|
40
40
|
("resources_count", lambda o: len(o.resources)),
|
|
41
41
|
("main_resources_count", lambda o: len([r for r in o.resources if r.type == "main"])),
|
|
42
42
|
("resources_formats", lambda o: ",".join(set(r.format for r in o.resources if r.format))),
|
|
43
|
-
"downloads",
|
|
44
43
|
("harvest.backend", lambda r: r.harvest and r.harvest.backend),
|
|
45
44
|
("harvest.domain", lambda r: r.harvest and r.harvest.domain),
|
|
46
45
|
("harvest.created_at", lambda r: r.harvest and r.harvest.created_at),
|
udata/core/dataset/models.py
CHANGED
|
@@ -897,10 +897,6 @@ class Dataset(WithMetrics, DatasetBadgeMixin, Owned, db.Document):
|
|
|
897
897
|
|
|
898
898
|
return result
|
|
899
899
|
|
|
900
|
-
@property
|
|
901
|
-
def downloads(self):
|
|
902
|
-
return sum(resource.metrics.get("views", 0) for resource in self.resources)
|
|
903
|
-
|
|
904
900
|
@staticmethod
|
|
905
901
|
def normalize_score(score):
|
|
906
902
|
"""
|
|
@@ -19,6 +19,8 @@ from udata.core.dataset.api_fields import (
|
|
|
19
19
|
resource_harvest_fields,
|
|
20
20
|
)
|
|
21
21
|
from udata.core.dataset.constants import (
|
|
22
|
+
DEFAULT_FREQUENCY,
|
|
23
|
+
DEFAULT_LICENSE,
|
|
22
24
|
FULL_OBJECTS_HEADER,
|
|
23
25
|
LEGACY_FREQUENCIES,
|
|
24
26
|
RESOURCE_TYPES,
|
|
@@ -512,6 +514,7 @@ class DatasetAPITest(APITestCase):
|
|
|
512
514
|
license = LicenseFactory(id="lov2", title="Licence Ouverte Version 2.0")
|
|
513
515
|
paca, bdr, arles = create_geozones_fixtures()
|
|
514
516
|
country = GeoLevelFactory(id="country", name="Pays", admin_level=10)
|
|
517
|
+
other = GeoLevelFactory(id="other", name="Autre")
|
|
515
518
|
|
|
516
519
|
dataset = DatasetFactory(
|
|
517
520
|
frequency="monthly",
|
|
@@ -542,6 +545,27 @@ class DatasetAPITest(APITestCase):
|
|
|
542
545
|
assert response.json["spatial"]["granularity"]["id"] == "country"
|
|
543
546
|
assert response.json["spatial"]["granularity"]["name"] == country.name
|
|
544
547
|
|
|
548
|
+
dataset_without_anything = DatasetFactory(
|
|
549
|
+
frequency=None,
|
|
550
|
+
license=None,
|
|
551
|
+
spatial=SpatialCoverageFactory(zones=[], granularity=None),
|
|
552
|
+
)
|
|
553
|
+
|
|
554
|
+
response = self.get(
|
|
555
|
+
url_for("apiv2.dataset", dataset=dataset_without_anything),
|
|
556
|
+
headers={
|
|
557
|
+
FULL_OBJECTS_HEADER: "True",
|
|
558
|
+
},
|
|
559
|
+
)
|
|
560
|
+
self.assert200(response)
|
|
561
|
+
assert response.json["frequency"]["id"] == DEFAULT_FREQUENCY
|
|
562
|
+
assert response.json["frequency"]["label"] == UPDATE_FREQUENCIES.get(DEFAULT_FREQUENCY)
|
|
563
|
+
assert response.json["license"]["id"] == DEFAULT_LICENSE["id"]
|
|
564
|
+
assert response.json["license"]["title"] == DEFAULT_LICENSE["title"]
|
|
565
|
+
assert len(response.json["spatial"]["zones"]) == 0
|
|
566
|
+
assert response.json["spatial"]["granularity"]["id"] == "other"
|
|
567
|
+
assert response.json["spatial"]["granularity"]["name"] == other.name
|
|
568
|
+
|
|
545
569
|
def test_dataset_api_create(self):
|
|
546
570
|
"""It should create a dataset from the API"""
|
|
547
571
|
data = DatasetFactory.as_dict()
|
|
@@ -21,7 +21,10 @@ class DatasetCSVAdapterTest:
|
|
|
21
21
|
"created_at": date_created,
|
|
22
22
|
"modified_at": date_modified,
|
|
23
23
|
"uri": "http://domain.gouv.fr/dataset/uri",
|
|
24
|
-
}
|
|
24
|
+
},
|
|
25
|
+
metrics={
|
|
26
|
+
"views": 42,
|
|
27
|
+
},
|
|
25
28
|
)
|
|
26
29
|
],
|
|
27
30
|
harvest={
|
|
@@ -41,6 +44,8 @@ class DatasetCSVAdapterTest:
|
|
|
41
44
|
assert date_modified.isoformat() in d_row
|
|
42
45
|
# dataset harvest dates should not be here
|
|
43
46
|
assert another_date.isoformat() not in d_row
|
|
47
|
+
# assert resource metrics downloads
|
|
48
|
+
assert 42 in d_row
|
|
44
49
|
|
|
45
50
|
def test_datasets_csv_adapter(self):
|
|
46
51
|
date_created = datetime(2022, 12, 31)
|
|
@@ -87,10 +92,8 @@ class DatasetCSVAdapterTest:
|
|
|
87
92
|
assert harvest_dataset_values["harvest.domain"] == "example.com"
|
|
88
93
|
assert harvest_dataset_values["harvest.remote_url"] == "https://www.example.com/"
|
|
89
94
|
assert harvest_dataset_values["resources_count"] == 0
|
|
90
|
-
assert harvest_dataset_values["downloads"] == 0
|
|
91
95
|
|
|
92
96
|
resources_dataset_values = csv[str(resources_dataset.id)]
|
|
93
97
|
assert resources_dataset_values["resources_count"] == 3
|
|
94
98
|
assert resources_dataset_values["main_resources_count"] == 1
|
|
95
99
|
assert set(resources_dataset_values["resources_formats"].split(",")) == set(["csv", "json"])
|
|
96
|
-
assert resources_dataset_values["downloads"] == 1337 + 42
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 10.4.1.
|
|
3
|
+
Version: 10.4.1.dev35211
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -141,6 +141,8 @@ It is collectively taken care of by members of the
|
|
|
141
141
|
|
|
142
142
|
## Current (in progress)
|
|
143
143
|
|
|
144
|
+
- Remove duplicate `downloads` in dataset csv adapter [#3319](https://github.com/opendatateam/udata/pull/3319)
|
|
145
|
+
- Add missing default for license full object [#3317](https://github.com/opendatateam/udata/pull/3317/)
|
|
144
146
|
- Check for slugs in followers API [#3320](https://github.com/opendatateam/udata/pull/3320)
|
|
145
147
|
- Fix missing ID in dataset reuses mask [#3321](https://github.com/opendatateam/udata/pull/3321)
|
|
146
148
|
|
|
@@ -96,15 +96,15 @@ udata/core/dataset/actions.py,sha256=mX6xox0PiMrbcAPZ3VZsI26rfM-ciYfEXxN6sqqImKA
|
|
|
96
96
|
udata/core/dataset/activities.py,sha256=v8k1jwhdx62Z2ARZq8Q-x86OWSsBK99hRloPl74OCgA,1502
|
|
97
97
|
udata/core/dataset/api.py,sha256=jElQZuguc514Eb0cWdquEfosP1yB79hEQ52SV_SvLx8,33282
|
|
98
98
|
udata/core/dataset/api_fields.py,sha256=SLuzWoPdMLPX28WQ9DRGUPKS27vlltiFeiTo6jXa55Q,17549
|
|
99
|
-
udata/core/dataset/apiv2.py,sha256=
|
|
99
|
+
udata/core/dataset/apiv2.py,sha256=YOCNqQh7_OODcrzqJqdAPc0CoB9vG0DVcFiJNl9yBwQ,20749
|
|
100
100
|
udata/core/dataset/commands.py,sha256=__hPAk_6iHtgMnEG51ux0vbNWJHxUjXhi1ukH4hF5jY,3714
|
|
101
101
|
udata/core/dataset/constants.py,sha256=fKn21GzRShZv6pzKy3TvEK1cevQ9H3dOFE-xTRuE0lA,2971
|
|
102
|
-
udata/core/dataset/csv.py,sha256=
|
|
102
|
+
udata/core/dataset/csv.py,sha256=OmfHUX5d325XJva2lqHNEBJz3vROfEqkiu1rBfS6Reg,3612
|
|
103
103
|
udata/core/dataset/events.py,sha256=bSM0nFEX14r4JHc-bAM-7OOuD3JAxUIpw9GgXbOsUyw,4078
|
|
104
104
|
udata/core/dataset/exceptions.py,sha256=uKiayLSpSzsnLvClObS6hOO0qXEqvURKN7_w8eimQNU,498
|
|
105
105
|
udata/core/dataset/factories.py,sha256=fRDWDlybR_ud4pDs1-ntWuYHKtV9LMHeBOBp2SmTT6M,9006
|
|
106
106
|
udata/core/dataset/forms.py,sha256=7KUxuFcEGT0MUe0cZCiZtsnZhvGgvEd68pe13NgeSMI,6292
|
|
107
|
-
udata/core/dataset/models.py,sha256=
|
|
107
|
+
udata/core/dataset/models.py,sha256=lu-EFDSWa8qz81LbI39F1XsTO5Tv2QfEbEp5ieq-WIE,40710
|
|
108
108
|
udata/core/dataset/permissions.py,sha256=zXQ6kU-Ni3Pl5tDtat-ZPupug9InsNeCN7xRLc2Vcrc,1097
|
|
109
109
|
udata/core/dataset/preview.py,sha256=IwCqiNTjjXbtA_SSKF52pwnzKKEz0GyYM95QNn2Dkog,2561
|
|
110
110
|
udata/core/dataset/rdf.py,sha256=HkjzcWgq9AfPvUGMRI7-ufRrgnlfBmP8crbgRhg6Lz4,31789
|
|
@@ -626,7 +626,7 @@ udata/tests/api/test_auth_api.py,sha256=OMRlY0OQt60j5N4A-N3HdWTuffOjRlFHkz5a3jJF
|
|
|
626
626
|
udata/tests/api/test_base_api.py,sha256=2w_vz0eEuq3P3aN-ByvxGc3VZAo7XtgatFfcrzf2uEU,2244
|
|
627
627
|
udata/tests/api/test_contact_points.py,sha256=X_RWD_xCfR8WchhHfKEt5mxMHY77OmTyguNKCsZftdE,5337
|
|
628
628
|
udata/tests/api/test_dataservices_api.py,sha256=fNpeHl4SMvci3QrC414X6KGorv7NS1y8LsGxcSMjjZY,25729
|
|
629
|
-
udata/tests/api/test_datasets_api.py,sha256=
|
|
629
|
+
udata/tests/api/test_datasets_api.py,sha256=Igu8NrOfDEtYKjlG7CrL_VpiFN2Tp6W-Kj4r8mpK1os,98789
|
|
630
630
|
udata/tests/api/test_fields.py,sha256=OW85Z5MES5HeWOpapeem8OvR1cIcrqW-xMWpdZO4LZ8,1033
|
|
631
631
|
udata/tests/api/test_follow_api.py,sha256=XP6I96JUNT6xjGcQOF7pug_T_i67HzCiOGLaPdpfpEQ,4912
|
|
632
632
|
udata/tests/api/test_me_api.py,sha256=YPd8zmR3zwJKtpSqz8nY1nOOMyXs66INeBwyhg5D0Us,13846
|
|
@@ -653,7 +653,7 @@ udata/tests/dataservice/test_csv_adapter.py,sha256=UyDPiqKIDwe0AdXLKLpSsBqe4ZJsf
|
|
|
653
653
|
udata/tests/dataservice/test_dataservice_rdf.py,sha256=VLFgdclFoIhmctfMEgTxvuNlRxcI1yDkZWE-lbEYGdQ,2984
|
|
654
654
|
udata/tests/dataservice/test_dataservice_tasks.py,sha256=9XUoYLb_p3dzmgLfswaXjMG2civP0i1kzzP4VdJWE0k,1614
|
|
655
655
|
udata/tests/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
656
|
-
udata/tests/dataset/test_csv_adapter.py,sha256=
|
|
656
|
+
udata/tests/dataset/test_csv_adapter.py,sha256=7U83RiuSKNVgX-mV45Txp9a828mnWE4eKrU7K-36Dbs,3906
|
|
657
657
|
udata/tests/dataset/test_dataset_actions.py,sha256=bgDjVYjOvu3sX_FCTCzf2snZYSprsqor2nAhIVuokSs,722
|
|
658
658
|
udata/tests/dataset/test_dataset_commands.py,sha256=zMPJG2wYwKBee2zI65kmboxf59Zqa84DDjT8V5wj9uo,801
|
|
659
659
|
udata/tests/dataset/test_dataset_events.py,sha256=hlrpoOiBbnX_COUI9Pzdqlp45GZZDqu5piwupbnPiTI,3601
|
|
@@ -726,9 +726,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=ViV14tUmjSydHS0TWG_mFikKQfyUaT
|
|
|
726
726
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=rzAD_MVoV54TmN3w1ECz3H2Ru5pM7hWMVH03SkY28Q8,47250
|
|
727
727
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=EHX1_D-Uglj38832G7BrA0QC5IuY3p8dKqi9T0DgPmE,29169
|
|
728
728
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=3PMnbVhKVJh6Q8ABi1ZTZ8Dcf-sMjngLJZqLbonJoec,54225
|
|
729
|
-
udata-10.4.1.
|
|
730
|
-
udata-10.4.1.
|
|
731
|
-
udata-10.4.1.
|
|
732
|
-
udata-10.4.1.
|
|
733
|
-
udata-10.4.1.
|
|
734
|
-
udata-10.4.1.
|
|
729
|
+
udata-10.4.1.dev35211.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
730
|
+
udata-10.4.1.dev35211.dist-info/METADATA,sha256=_9rRGg-d94ckfv-S7fyQx-lTwUhyclEnoAyQe6PFAIg,146456
|
|
731
|
+
udata-10.4.1.dev35211.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
|
|
732
|
+
udata-10.4.1.dev35211.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
|
|
733
|
+
udata-10.4.1.dev35211.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
734
|
+
udata-10.4.1.dev35211.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|