udata 9.2.2__py2.py3-none-any.whl → 9.2.2.dev31569__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/__init__.py +1 -1
- udata/core/contact_point/api.py +1 -6
- udata/core/contact_point/forms.py +1 -4
- udata/core/contact_point/models.py +1 -10
- udata/core/dataservices/models.py +4 -1
- udata/core/dataset/csv.py +16 -4
- udata/core/discussions/api.py +1 -24
- udata/static/chunks/{11.16618d9eedd3f6a7a3c2.js → 11.18f1cc16362b76373c40.js} +3 -3
- udata/static/chunks/{11.16618d9eedd3f6a7a3c2.js.map → 11.18f1cc16362b76373c40.js.map} +1 -1
- udata/static/chunks/{13.7c17956e2fcfafcab22f.js → 13.066b4d36814efa6c485f.js} +2 -2
- udata/static/chunks/{13.7c17956e2fcfafcab22f.js.map → 13.066b4d36814efa6c485f.js.map} +1 -1
- udata/static/chunks/{16.b4cda3ca8dc053495fbd.js → 16.cddb601c07a2df6564b2.js} +2 -2
- udata/static/chunks/{16.b4cda3ca8dc053495fbd.js.map → 16.cddb601c07a2df6564b2.js.map} +1 -1
- udata/static/chunks/{19.f1ff6cd5816f2d9debc4.js → 19.2061dca8438f415029a3.js} +3 -3
- udata/static/chunks/{19.f1ff6cd5816f2d9debc4.js.map → 19.2061dca8438f415029a3.js.map} +1 -1
- udata/static/chunks/{5.ba3e2202db0e1d78cebf.js → 5.4e4ddeee32090f1f2af6.js} +3 -3
- udata/static/chunks/{5.ba3e2202db0e1d78cebf.js.map → 5.4e4ddeee32090f1f2af6.js.map} +1 -1
- udata/static/chunks/{6.2938efcf4f38dfccab9e.js → 6.41b17f3ca439d5ec2b1e.js} +3 -3
- udata/static/chunks/{6.2938efcf4f38dfccab9e.js.map → 6.41b17f3ca439d5ec2b1e.js.map} +1 -1
- udata/static/chunks/{8.b50a30118e9e2e1ab436.js → 8.292c6a157d71f0b21b6f.js} +2 -2
- udata/static/chunks/{8.b50a30118e9e2e1ab436.js.map → 8.292c6a157d71f0b21b6f.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tests/api/test_contact_points.py +1 -40
- udata/tests/dataset/test_csv_adapter.py +2 -9
- udata/tests/test_discussions.py +0 -61
- udata/translations/ar/LC_MESSAGES/udata.mo +0 -0
- udata/translations/ar/LC_MESSAGES/udata.po +92 -88
- udata/translations/de/LC_MESSAGES/udata.mo +0 -0
- udata/translations/de/LC_MESSAGES/udata.po +92 -88
- udata/translations/es/LC_MESSAGES/udata.mo +0 -0
- udata/translations/es/LC_MESSAGES/udata.po +92 -88
- udata/translations/fr/LC_MESSAGES/udata.mo +0 -0
- udata/translations/fr/LC_MESSAGES/udata.po +92 -88
- udata/translations/it/LC_MESSAGES/udata.mo +0 -0
- udata/translations/it/LC_MESSAGES/udata.po +92 -88
- udata/translations/pt/LC_MESSAGES/udata.mo +0 -0
- udata/translations/pt/LC_MESSAGES/udata.po +92 -88
- udata/translations/sr/LC_MESSAGES/udata.mo +0 -0
- udata/translations/sr/LC_MESSAGES/udata.po +92 -88
- udata/translations/udata.pot +93 -89
- {udata-9.2.2.dist-info → udata-9.2.2.dev31569.dist-info}/METADATA +3 -7
- {udata-9.2.2.dist-info → udata-9.2.2.dev31569.dist-info}/RECORD +47 -48
- udata/core/discussions/csv.py +0 -22
- {udata-9.2.2.dist-info → udata-9.2.2.dev31569.dist-info}/LICENSE +0 -0
- {udata-9.2.2.dist-info → udata-9.2.2.dev31569.dist-info}/WHEEL +0 -0
- {udata-9.2.2.dist-info → udata-9.2.2.dev31569.dist-info}/entry_points.txt +0 -0
- {udata-9.2.2.dist-info → udata-9.2.2.dev31569.dist-info}/top_level.txt +0 -0
udata/__init__.py
CHANGED
udata/core/contact_point/api.py
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import mongoengine
|
|
2
|
-
|
|
3
1
|
from udata.api import API, api
|
|
4
2
|
from udata.api.parsers import ModelApiParser
|
|
5
3
|
|
|
@@ -31,10 +29,7 @@ class ContactPointsListAPI(API):
|
|
|
31
29
|
def post(self):
|
|
32
30
|
"""Creates a contact point"""
|
|
33
31
|
form = api.validate(ContactPointForm)
|
|
34
|
-
|
|
35
|
-
contact_point = form.save()
|
|
36
|
-
except mongoengine.errors.ValidationError as e:
|
|
37
|
-
api.abort(400, e.message)
|
|
32
|
+
contact_point = form.save()
|
|
38
33
|
return contact_point, 201
|
|
39
34
|
|
|
40
35
|
|
|
@@ -12,9 +12,6 @@ class ContactPointForm(ModelForm):
|
|
|
12
12
|
_("Name"),
|
|
13
13
|
[validators.DataRequired(), validators.NoURLs(_("URLs not allowed in this field"))],
|
|
14
14
|
)
|
|
15
|
-
email = fields.StringField(_("Email"), [validators.
|
|
16
|
-
contact_form = fields.URLField(
|
|
17
|
-
_("Contact form"), description=_("The organization web contact form")
|
|
18
|
-
)
|
|
15
|
+
email = fields.StringField(_("Email"), [validators.DataRequired(), validators.Email()])
|
|
19
16
|
owner = fields.CurrentUserField()
|
|
20
17
|
organization = fields.PublishAsField(_("Publish as"))
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
from udata.core.owned import Owned, OwnedQuerySet
|
|
2
|
-
from udata.i18n import lazy_gettext as _
|
|
3
2
|
from udata.mongo import db
|
|
4
3
|
|
|
5
4
|
__all__ = ("ContactPoint",)
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
class ContactPoint(db.Document, Owned):
|
|
8
|
+
email = db.StringField(max_length=255, required=True)
|
|
9
9
|
name = db.StringField(max_length=255, required=True)
|
|
10
|
-
email = db.StringField(max_length=255)
|
|
11
|
-
contact_form = db.URLField()
|
|
12
10
|
|
|
13
11
|
meta = {"queryset_class": OwnedQuerySet}
|
|
14
|
-
|
|
15
|
-
def validate(self, clean=True):
|
|
16
|
-
if not self.email and not self.contact_form:
|
|
17
|
-
raise db.ValidationError(
|
|
18
|
-
_("At least an email or a contact form is required for a contact point")
|
|
19
|
-
)
|
|
20
|
-
return super().validate(clean=clean)
|
|
@@ -122,7 +122,10 @@ class Dataservice(WithMetrics, Owned, db.Document):
|
|
|
122
122
|
readonly=True,
|
|
123
123
|
)
|
|
124
124
|
description = field(db.StringField(default=""), description="In markdown")
|
|
125
|
-
base_api_url = field(
|
|
125
|
+
base_api_url = field(
|
|
126
|
+
db.URLField(required=True),
|
|
127
|
+
sortable=True,
|
|
128
|
+
)
|
|
126
129
|
endpoint_description_url = field(db.URLField())
|
|
127
130
|
authorization_request_url = field(db.URLField())
|
|
128
131
|
availability = field(db.FloatField(min=0, max=100), example="99.99")
|
udata/core/dataset/csv.py
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
from udata.core.discussions.csv import DiscussionCsvAdapter # noqa: F401
|
|
1
|
+
from udata.core.discussions.models import Discussion
|
|
3
2
|
from udata.frontend import csv
|
|
4
3
|
|
|
5
4
|
from .models import Dataset, Resource
|
|
@@ -37,13 +36,11 @@ class DatasetCsvAdapter(csv.Adapter):
|
|
|
37
36
|
("archived", lambda o: o.archived or False),
|
|
38
37
|
("resources_count", lambda o: len(o.resources)),
|
|
39
38
|
("main_resources_count", lambda o: len([r for r in o.resources if r.type == "main"])),
|
|
40
|
-
("resources_formats", lambda o: ",".join(set(r.format for r in o.resources if r.format))),
|
|
41
39
|
"downloads",
|
|
42
40
|
("harvest.backend", lambda r: r.harvest and r.harvest.backend),
|
|
43
41
|
("harvest.domain", lambda r: r.harvest and r.harvest.domain),
|
|
44
42
|
("harvest.created_at", lambda r: r.harvest and r.harvest.created_at),
|
|
45
43
|
("harvest.modified_at", lambda r: r.harvest and r.harvest.modified_at),
|
|
46
|
-
("harvest.remote_url", lambda r: r.harvest and r.harvest.remote_url),
|
|
47
44
|
("quality_score", lambda o: format(o.quality["score"], ".2f")),
|
|
48
45
|
# schema? what is the schema of a dataset?
|
|
49
46
|
)
|
|
@@ -93,3 +90,18 @@ class ResourcesCsvAdapter(csv.NestedAdapter):
|
|
|
93
90
|
("preview_url", lambda o: o.preview_url or False),
|
|
94
91
|
)
|
|
95
92
|
attribute = "resources"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
@csv.adapter(Discussion)
|
|
96
|
+
class DiscussionCsvAdapter(csv.Adapter):
|
|
97
|
+
fields = (
|
|
98
|
+
"id",
|
|
99
|
+
"user",
|
|
100
|
+
"subject",
|
|
101
|
+
"title",
|
|
102
|
+
("size", lambda o: len(o.discussion)),
|
|
103
|
+
("messages", lambda o: "\n".join(msg.content for msg in o.discussion)),
|
|
104
|
+
"created",
|
|
105
|
+
"closed",
|
|
106
|
+
"closed_by",
|
|
107
|
+
)
|
udata/core/discussions/api.py
CHANGED
|
@@ -6,10 +6,6 @@ from flask_security import current_user
|
|
|
6
6
|
|
|
7
7
|
from udata.api import API, api, fields
|
|
8
8
|
from udata.auth import admin_permission
|
|
9
|
-
from udata.core.dataservices.models import Dataservice
|
|
10
|
-
from udata.core.dataset.models import Dataset
|
|
11
|
-
from udata.core.organization.models import Organization
|
|
12
|
-
from udata.core.reuse.models import Reuse
|
|
13
9
|
from udata.core.spam.api import SpamAPIMixin
|
|
14
10
|
from udata.core.spam.fields import spam_fields
|
|
15
11
|
from udata.core.user.api_fields import user_ref_fields
|
|
@@ -77,15 +73,8 @@ comment_discussion_fields = api.model(
|
|
|
77
73
|
discussion_page_fields = api.model("DiscussionPage", fields.pager(discussion_fields))
|
|
78
74
|
|
|
79
75
|
parser = api.parser()
|
|
80
|
-
sorting_keys: list[str] = ["created", "title", "closed"]
|
|
81
|
-
sorting_choices: list[str] = sorting_keys + ["-" + k for k in sorting_keys]
|
|
82
76
|
parser.add_argument(
|
|
83
|
-
"sort",
|
|
84
|
-
type=str,
|
|
85
|
-
default="-created",
|
|
86
|
-
choices=sorting_choices,
|
|
87
|
-
location="args",
|
|
88
|
-
help="The field (and direction) on which sorting apply",
|
|
77
|
+
"sort", type=str, default="-created", location="args", help="The sorting attribute"
|
|
89
78
|
)
|
|
90
79
|
parser.add_argument(
|
|
91
80
|
"closed",
|
|
@@ -96,9 +85,6 @@ parser.add_argument(
|
|
|
96
85
|
parser.add_argument(
|
|
97
86
|
"for", type=str, location="args", action="append", help="Filter discussions for a given subject"
|
|
98
87
|
)
|
|
99
|
-
parser.add_argument(
|
|
100
|
-
"org", type=str, location="args", help="Filter discussions for a given organization"
|
|
101
|
-
)
|
|
102
88
|
parser.add_argument("user", type=str, location="args", help="Filter discussions created by a user")
|
|
103
89
|
parser.add_argument("page", type=int, default=1, location="args", help="The page to fetch")
|
|
104
90
|
parser.add_argument(
|
|
@@ -212,15 +198,6 @@ class DiscussionsAPI(API):
|
|
|
212
198
|
discussions = Discussion.objects
|
|
213
199
|
if args["for"]:
|
|
214
200
|
discussions = discussions.generic_in(subject=args["for"])
|
|
215
|
-
if args["org"]:
|
|
216
|
-
org = Organization.objects.get_or_404(id=id_or_404(args["org"]))
|
|
217
|
-
if not org:
|
|
218
|
-
api.abort(404, "Organization does not exist")
|
|
219
|
-
reuses = Reuse.objects(organization=org).only("id")
|
|
220
|
-
datasets = Dataset.objects(organization=org).only("id")
|
|
221
|
-
dataservices = Dataservice.objects(organization=org).only("id")
|
|
222
|
-
subjects = list(reuses) + list(datasets) + list(dataservices)
|
|
223
|
-
discussions = discussions(subject__in=subjects)
|
|
224
201
|
if args["user"]:
|
|
225
202
|
discussions = discussions(discussion__posted_by=ObjectId(args["user"]))
|
|
226
203
|
if args["closed"] is False:
|