udata 7.0.7.dev28634__py2.py3-none-any.whl → 7.0.7.dev28639__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/api/__init__.py +14 -0
- udata/core/dataset/forms.py +1 -3
- udata/core/dataset/models.py +2 -1
- udata/models/__init__.py +0 -7
- udata/mongo/errors.py +8 -0
- udata/rdf.py +2 -2
- {udata-7.0.7.dev28634.dist-info → udata-7.0.7.dev28639.dist-info}/METADATA +2 -1
- {udata-7.0.7.dev28634.dist-info → udata-7.0.7.dev28639.dist-info}/RECORD +12 -11
- {udata-7.0.7.dev28634.dist-info → udata-7.0.7.dev28639.dist-info}/LICENSE +0 -0
- {udata-7.0.7.dev28634.dist-info → udata-7.0.7.dev28639.dist-info}/WHEEL +0 -0
- {udata-7.0.7.dev28634.dist-info → udata-7.0.7.dev28639.dist-info}/entry_points.txt +0 -0
- {udata-7.0.7.dev28634.dist-info → udata-7.0.7.dev28639.dist-info}/top_level.txt +0 -0
udata/api/__init__.py
CHANGED
|
@@ -20,6 +20,7 @@ from udata.auth import (
|
|
|
20
20
|
current_user, login_user, Permission, RoleNeed, PermissionDenied
|
|
21
21
|
)
|
|
22
22
|
from udata.utils import safe_unicode
|
|
23
|
+
from udata.mongo.errors import FieldValidationError
|
|
23
24
|
|
|
24
25
|
from . import fields, oauth2
|
|
25
26
|
from .signals import on_api_call
|
|
@@ -283,6 +284,19 @@ def handle_unauthorized_file_type(error):
|
|
|
283
284
|
return {'message': msg}, 400
|
|
284
285
|
|
|
285
286
|
|
|
287
|
+
validation_error_fields = api.model('ValidationError', {
|
|
288
|
+
'errors': fields.Raw
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
@api.errorhandler(FieldValidationError)
|
|
292
|
+
@api.marshal_with(validation_error_fields, code=400)
|
|
293
|
+
def handle_validation_error(error: FieldValidationError):
|
|
294
|
+
'''A validation error'''
|
|
295
|
+
errors = {}
|
|
296
|
+
errors[error.field] = [error.message]
|
|
297
|
+
|
|
298
|
+
return { 'errors': errors}, 400
|
|
299
|
+
|
|
286
300
|
class API(Resource): # Avoid name collision as resource is a core model
|
|
287
301
|
pass
|
|
288
302
|
|
udata/core/dataset/forms.py
CHANGED
|
@@ -5,6 +5,7 @@ from udata.i18n import lazy_gettext as _
|
|
|
5
5
|
|
|
6
6
|
from udata.core.storages import resources
|
|
7
7
|
from udata.core.spatial.forms import SpatialCoverageField
|
|
8
|
+
from udata.mongo.errors import FieldValidationError
|
|
8
9
|
|
|
9
10
|
from .models import (
|
|
10
11
|
Dataset, Resource, Schema, License, Checksum, CommunityResource,
|
|
@@ -16,9 +17,6 @@ from .constants import (
|
|
|
16
17
|
|
|
17
18
|
__all__ = ('DatasetForm', 'ResourceForm', 'CommunityResourceForm')
|
|
18
19
|
|
|
19
|
-
from ...models import FieldValidationError
|
|
20
|
-
|
|
21
|
-
|
|
22
20
|
class ChecksumForm(ModelForm):
|
|
23
21
|
model_class = Checksum
|
|
24
22
|
choices = list(zip(CHECKSUM_TYPES, CHECKSUM_TYPES))
|
udata/core/dataset/models.py
CHANGED
|
@@ -18,7 +18,8 @@ from typing import Optional, Tuple
|
|
|
18
18
|
from udata.app import cache
|
|
19
19
|
from udata.core import storages
|
|
20
20
|
from udata.frontend.markdown import mdstrip
|
|
21
|
-
from udata.models import db, WithMetrics, BadgeMixin, SpatialCoverage
|
|
21
|
+
from udata.models import db, WithMetrics, BadgeMixin, SpatialCoverage
|
|
22
|
+
from udata.mongo.errors import FieldValidationError
|
|
22
23
|
from udata.i18n import lazy_gettext as _
|
|
23
24
|
from udata.utils import get_by, hash_url, to_naive_datetime
|
|
24
25
|
from udata.uris import ValidationError, endpoint_for
|
udata/models/__init__.py
CHANGED
|
@@ -3,13 +3,6 @@ from mongoengine.errors import ValidationError
|
|
|
3
3
|
from udata import entrypoints
|
|
4
4
|
from udata.mongo import *
|
|
5
5
|
|
|
6
|
-
class FieldValidationError(ValidationError):
|
|
7
|
-
field: str
|
|
8
|
-
|
|
9
|
-
def __init__(self, *args, field: str, **kwargs):
|
|
10
|
-
self.field = field
|
|
11
|
-
super().__init__(*args, **kwargs)
|
|
12
|
-
|
|
13
6
|
# Load all core models and mixins
|
|
14
7
|
from udata.core.spatial.models import * # noqa
|
|
15
8
|
from udata.core.metrics.models import * # noqa
|
udata/mongo/errors.py
ADDED
udata/rdf.py
CHANGED
|
@@ -13,8 +13,8 @@ from rdflib.namespace import (
|
|
|
13
13
|
)
|
|
14
14
|
from rdflib.util import SUFFIX_FORMAT_MAP, guess_format as raw_guess_format
|
|
15
15
|
from udata import uris
|
|
16
|
-
from udata.models import
|
|
17
|
-
from
|
|
16
|
+
from udata.models import Schema
|
|
17
|
+
from udata.mongo.errors import FieldValidationError
|
|
18
18
|
|
|
19
19
|
log = logging.getLogger(__name__)
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 7.0.7.
|
|
3
|
+
Version: 7.0.7.dev28639
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -139,6 +139,7 @@ It is collectively taken care of by members of the
|
|
|
139
139
|
- Move `db` and Mongo fields classes outside `udata.models` [#3005](https://github.com/opendatateam/udata/pull/3005)
|
|
140
140
|
- :warning: Update LICENSE_GROUPS config layout [#3010](https://github.com/opendatateam/udata/pull/3010)
|
|
141
141
|
- Remove unused dependencies [#3006](https://github.com/opendatateam/udata/pull/3006)
|
|
142
|
+
- Move `FieldValidationError` into its own module and add an error handler [#3012](https://github.com/opendatateam/udata/pull/3012)
|
|
142
143
|
- Move some `import User` to runtime imports [#3013](https://github.com/opendatateam/udata/pull/3013)
|
|
143
144
|
- Move `Owned` mixin to its own module [#3008](https://github.com/opendatateam/udata/pull/3008)
|
|
144
145
|
- Move `badge_fields` to separate module than `models.py` [#3011](https://github.com/opendatateam/udata/pull/3011)
|
|
@@ -8,7 +8,7 @@ udata/errors.py,sha256=chc1880TPGteIL-Rfb9hdeAyZI4vdWZQU3JQ_5VF5t0,116
|
|
|
8
8
|
udata/factories.py,sha256=6en2qdHHoR6rEvNEUeH_0-T-vR7x7GUBGgNEm9vuylE,492
|
|
9
9
|
udata/i18n.py,sha256=E-JoY57Cv4vgPvChkWjpwZAbuYVI8e6BO6raeu_3_Pw,8352
|
|
10
10
|
udata/mail.py,sha256=dAMcbEtk5e54alpQezvF5adDrRPgdaT36QEdHD_5v50,2145
|
|
11
|
-
udata/rdf.py,sha256=
|
|
11
|
+
udata/rdf.py,sha256=QiHcK2iklbtPkl6UFdBxTj0oaiY41en9k-kmbIVJ8Xw,9893
|
|
12
12
|
udata/routing.py,sha256=lU1XNL-YQgx1GN3pjKue1tIjHzjO3QdTiF9aaLNLitg,7044
|
|
13
13
|
udata/sentry.py,sha256=KiZz0PpmYpZMvykH9UAbHpF4xBY0Q-8DeiEbXEHDUdw,2683
|
|
14
14
|
udata/settings.py,sha256=5cU5_oiPiuS8RS98F9qfCp37qbjjN_g8ipoyZjDQP0M,17298
|
|
@@ -23,7 +23,7 @@ udata/worker.py,sha256=K-Wafye5-uXP4kQlffRKws2J9YbJ6m6n2QjcVsY8Nsg,118
|
|
|
23
23
|
udata/wsgi.py,sha256=P7AJvZ5JqY4uRSBOzaFiBniChWIU9RVQ-Y0PN4vCCMY,77
|
|
24
24
|
udata/admin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
udata/admin/views.py,sha256=wMlpnC1aINW-6JDk6-kQXhcTYBZH-5wajEuWzVDcIKA,331
|
|
26
|
-
udata/api/__init__.py,sha256=
|
|
26
|
+
udata/api/__init__.py,sha256=7AZWPTUCt-ib0FlPm-lEInFdHB1cruPjq-n_fLsRWRw,11278
|
|
27
27
|
udata/api/commands.py,sha256=oK2p1VdUvULDdYuvYYpYvY_bdkPJy-KfROfoX71oOuA,3277
|
|
28
28
|
udata/api/errors.py,sha256=Sy_f3WVrNTUPZjCOogIVgocDdUjnKz149KDi4mMA_Lg,240
|
|
29
29
|
udata/api/fields.py,sha256=l-Fa27-easR86qgof2bk130jq1N1pNUgGmQzok1UI3Q,3094
|
|
@@ -89,8 +89,8 @@ udata/core/dataset/csv.py,sha256=d6JMuvlov_vR7EN10rJa6Q03Il0PfbzMTHQIud5H8qg,324
|
|
|
89
89
|
udata/core/dataset/events.py,sha256=DI71VfRc1eDTtgWQ3TJx5gtUw2MO0O_CVLCKLq0OIF0,3207
|
|
90
90
|
udata/core/dataset/exceptions.py,sha256=uI_NvZRZMr_MtYQBYdLD8tk-BIUeDDfMMcrWwqV7mi8,494
|
|
91
91
|
udata/core/dataset/factories.py,sha256=fHPgEUUpqGw7p7K5wGg-wA6Q0-Pc9eNbzAQK-va8zMM,9120
|
|
92
|
-
udata/core/dataset/forms.py,sha256=
|
|
93
|
-
udata/core/dataset/models.py,sha256=
|
|
92
|
+
udata/core/dataset/forms.py,sha256=VJCsGtgzhQgLW-M-J4ObpQ8o6c_saC3TTc1Js33m3sQ,6188
|
|
93
|
+
udata/core/dataset/models.py,sha256=Z9Sqf-Aly67BB5ESwz3H4qxJvG3zy03Goz6enL55HyE,36022
|
|
94
94
|
udata/core/dataset/permissions.py,sha256=3F2J7le3_rEYNhh88o3hSRWHAAt01_yHJM6RPmvCrRo,1090
|
|
95
95
|
udata/core/dataset/preview.py,sha256=puPKT3fBD7ezAcT6owh0JK1_rGNDFZOqgT223qGn3LY,2597
|
|
96
96
|
udata/core/dataset/rdf.py,sha256=oQqVpDvDCQKsfp5LKlIXACxLg89LpA2ydbkICxZCvT0,22830
|
|
@@ -331,12 +331,13 @@ udata/migrations/2023-02-08-rename-internal-dates.py,sha256=AYewRwdVCfHsJ5APbhQW
|
|
|
331
331
|
udata/migrations/2024-01-29-fix-reuse-and-dataset-with-private-None.py,sha256=173Zf67G-oJgLwXeQUpzoCzcpAOu1ifcLb4eUMJ9nfU,590
|
|
332
332
|
udata/migrations/2024-03-22-migrate-activity-kwargs-to-extras.py,sha256=n5-udd1IdaD-e3q5cZx9nC4uMUSyJyT1TkI6I4gFgh0,400
|
|
333
333
|
udata/migrations/__init__.py,sha256=3YP8ppVG5Jx_u6fWJ099X6m3JDYsbd_wetpu4arl6_U,10882
|
|
334
|
-
udata/models/__init__.py,sha256=
|
|
334
|
+
udata/models/__init__.py,sha256=RNv3-9A3ARWgKYYBJv-lJNvakPR3JLiuZ6722-CO6Kc,1288
|
|
335
335
|
udata/mongo/__init__.py,sha256=_ubmmhJuo6_fpuoMPEAat9Pv-5K_8rDbUuXmhe62zvU,1419
|
|
336
336
|
udata/mongo/badges_field.py,sha256=NnHA6OT40UysQzO3qnxiDNLR-SCj19KlqD1c-p1DP2Q,984
|
|
337
337
|
udata/mongo/datetime_fields.py,sha256=f3Q4LYa9pKRdB2W2yZVFIuIqd7_ELim1djr6xjPhEZg,1932
|
|
338
338
|
udata/mongo/document.py,sha256=fqqzrj3Q85iYDJ3biwU-Dv_QJqS31IBf_TGqvppCSz4,1200
|
|
339
339
|
udata/mongo/engine.py,sha256=dLj-wEhdfk778Vqm7Tzq-Bg1M8_8BXLggug0hCvqdEs,2552
|
|
340
|
+
udata/mongo/errors.py,sha256=BrUSYcX1z_JyZguBsw8bzHBv-K4YTlQQSByBWzb50wM,230
|
|
340
341
|
udata/mongo/extras_fields.py,sha256=OQD-V2h2I9mrL7nP2YPx3QtsDt4TDZYxxjKEQNe5kug,3961
|
|
341
342
|
udata/mongo/queryset.py,sha256=2EH9BikDbQXkUsL9c0SotZKYAwkWXUTlk1fi9aJlX8Q,3118
|
|
342
343
|
udata/mongo/slug_fields.py,sha256=WOHfj1I7kIRxtEBYR83IirqLLhVX2WwqZQ0pKMODEmQ,6423
|
|
@@ -675,9 +676,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=zCVMB-a4-mLM1jNyYMk58rgVRaVIwQ
|
|
|
675
676
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=avfWczvlLBKSohyB55-4TLmUGMU_Rze4XmAo4OTk2v0,43513
|
|
676
677
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=ScuqdpaV4y1ZIpBAEfxeaKdzkyGZL0mJmKMoG6w0iRQ,28553
|
|
677
678
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=QpgEXh1eHjztPa7oNLXd_sds1DC95A-STTtZyTE4m-E,50093
|
|
678
|
-
udata-7.0.7.
|
|
679
|
-
udata-7.0.7.
|
|
680
|
-
udata-7.0.7.
|
|
681
|
-
udata-7.0.7.
|
|
682
|
-
udata-7.0.7.
|
|
683
|
-
udata-7.0.7.
|
|
679
|
+
udata-7.0.7.dev28639.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
680
|
+
udata-7.0.7.dev28639.dist-info/METADATA,sha256=urbhkUVJZqYRHWwG_faDwB9onhm6TRNPoXXckPHArJc,121330
|
|
681
|
+
udata-7.0.7.dev28639.dist-info/WHEEL,sha256=-G_t0oGuE7UD0DrSpVZnq1hHMBV9DD2XkS5v7XpmTnk,110
|
|
682
|
+
udata-7.0.7.dev28639.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
|
|
683
|
+
udata-7.0.7.dev28639.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
684
|
+
udata-7.0.7.dev28639.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|