udata 10.0.5.dev32777__py2.py3-none-any.whl → 10.0.5.dev32808__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/dataservices/models.py +10 -0
- udata/core/discussions/actions.py +4 -0
- udata/core/discussions/constants.py +7 -0
- udata/core/discussions/tasks.py +4 -6
- {udata-10.0.5.dev32777.dist-info → udata-10.0.5.dev32808.dist-info}/METADATA +2 -1
- {udata-10.0.5.dev32777.dist-info → udata-10.0.5.dev32808.dist-info}/RECORD +10 -10
- {udata-10.0.5.dev32777.dist-info → udata-10.0.5.dev32808.dist-info}/LICENSE +0 -0
- {udata-10.0.5.dev32777.dist-info → udata-10.0.5.dev32808.dist-info}/WHEEL +0 -0
- {udata-10.0.5.dev32777.dist-info → udata-10.0.5.dev32808.dist-info}/entry_points.txt +0 -0
- {udata-10.0.5.dev32777.dist-info → udata-10.0.5.dev32808.dist-info}/top_level.txt +0 -0
|
@@ -109,6 +109,11 @@ class Dataservice(WithMetrics, Owned, db.Document):
|
|
|
109
109
|
"auto_create_index_on_save": True,
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
+
verbose_name = _("dataservice")
|
|
113
|
+
|
|
114
|
+
def __str__(self):
|
|
115
|
+
return self.title or ""
|
|
116
|
+
|
|
112
117
|
title = field(
|
|
113
118
|
db.StringField(required=True),
|
|
114
119
|
example="My awesome API",
|
|
@@ -198,6 +203,11 @@ class Dataservice(WithMetrics, Owned, db.Document):
|
|
|
198
203
|
readonly=True,
|
|
199
204
|
)
|
|
200
205
|
|
|
206
|
+
def url_for(self, *args, **kwargs):
|
|
207
|
+
return endpoint_for(
|
|
208
|
+
"dataservices.show", "api.dataservice", dataservice=self, *args, **kwargs
|
|
209
|
+
)
|
|
210
|
+
|
|
201
211
|
@function_field(description="Link to the API endpoint for this dataservice")
|
|
202
212
|
def self_api_url(self):
|
|
203
213
|
return endpoint_for("api.dataservice", dataservice=self, _external=True)
|
|
@@ -16,6 +16,10 @@ def discussions_for(user, only_open=True):
|
|
|
16
16
|
datasets = Dataset.objects.owned_by(user.id, *user.organizations).only("id", "slug")
|
|
17
17
|
reuses = Reuse.objects.owned_by(user.id, *user.organizations).only("id", "slug")
|
|
18
18
|
|
|
19
|
+
# TODO: add dataservices when ready. It would now break notification routing in current admin
|
|
20
|
+
# since dataservices aren't supported by the current admin.
|
|
21
|
+
# dataservices = Dataservice.objects.owned_by(user.id, *user.organizations).only("id", "slug")
|
|
22
|
+
|
|
19
23
|
qs = Discussion.objects(subject__in=list(datasets) + list(reuses))
|
|
20
24
|
if only_open:
|
|
21
25
|
qs = qs(closed__exists=False)
|
|
@@ -1 +1,8 @@
|
|
|
1
|
+
from udata.core.dataservices.models import Dataservice
|
|
2
|
+
from udata.core.dataset.models import Dataset
|
|
3
|
+
from udata.core.post.models import Post
|
|
4
|
+
from udata.core.reuse.models import Reuse
|
|
5
|
+
|
|
1
6
|
COMMENT_SIZE_LIMIT = 50000
|
|
7
|
+
|
|
8
|
+
NOTIFY_DISCUSSION_SUBJECTS = (Dataset, Reuse, Post, Dataservice)
|
udata/core/discussions/tasks.py
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
from udata import mail
|
|
2
|
-
from udata.core.dataset.models import Dataset
|
|
3
|
-
from udata.core.post.models import Post
|
|
4
|
-
from udata.core.reuse.models import Reuse
|
|
5
2
|
from udata.i18n import lazy_gettext as _
|
|
6
3
|
from udata.tasks import connect, get_logger
|
|
7
4
|
|
|
5
|
+
from .constants import NOTIFY_DISCUSSION_SUBJECTS
|
|
8
6
|
from .models import Discussion
|
|
9
7
|
from .signals import on_discussion_closed, on_new_discussion, on_new_discussion_comment
|
|
10
8
|
|
|
@@ -23,7 +21,7 @@ def owner_recipients(discussion):
|
|
|
23
21
|
@connect(on_new_discussion, by_id=True)
|
|
24
22
|
def notify_new_discussion(discussion_id):
|
|
25
23
|
discussion = Discussion.objects.get(pk=discussion_id)
|
|
26
|
-
if isinstance(discussion.subject,
|
|
24
|
+
if isinstance(discussion.subject, NOTIFY_DISCUSSION_SUBJECTS):
|
|
27
25
|
recipients = owner_recipients(discussion)
|
|
28
26
|
subject = _("Your %(type)s have a new discussion", type=discussion.subject.verbose_name)
|
|
29
27
|
mail.send(
|
|
@@ -41,7 +39,7 @@ def notify_new_discussion(discussion_id):
|
|
|
41
39
|
def notify_new_discussion_comment(discussion_id, message=None):
|
|
42
40
|
discussion = Discussion.objects.get(pk=discussion_id)
|
|
43
41
|
message = discussion.discussion[message]
|
|
44
|
-
if isinstance(discussion.subject,
|
|
42
|
+
if isinstance(discussion.subject, NOTIFY_DISCUSSION_SUBJECTS):
|
|
45
43
|
recipients = owner_recipients(discussion) + [m.posted_by for m in discussion.discussion]
|
|
46
44
|
recipients = list({u.id: u for u in recipients if u != message.posted_by}.values())
|
|
47
45
|
subject = _("%(user)s commented your discussion", user=message.posted_by.fullname)
|
|
@@ -57,7 +55,7 @@ def notify_new_discussion_comment(discussion_id, message=None):
|
|
|
57
55
|
def notify_discussion_closed(discussion_id, message=None):
|
|
58
56
|
discussion = Discussion.objects.get(pk=discussion_id)
|
|
59
57
|
message = discussion.discussion[message]
|
|
60
|
-
if isinstance(discussion.subject,
|
|
58
|
+
if isinstance(discussion.subject, NOTIFY_DISCUSSION_SUBJECTS):
|
|
61
59
|
recipients = owner_recipients(discussion) + [m.posted_by for m in discussion.discussion]
|
|
62
60
|
recipients = list({u.id: u for u in recipients if u != message.posted_by}.values())
|
|
63
61
|
subject = _("A discussion has been closed")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 10.0.5.
|
|
3
|
+
Version: 10.0.5.dev32808
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -141,6 +141,7 @@ It is collectively taken care of by members of the
|
|
|
141
141
|
## Current (in progress)
|
|
142
142
|
|
|
143
143
|
- Add dataservice csv adapter [#3208](https://github.com/opendatateam/udata/pull/3208)
|
|
144
|
+
- Add url_for for dataservices and mail notifications [#3213](https://github.com/opendatateam/udata/pull/3213)
|
|
144
145
|
|
|
145
146
|
## 10.0.4 (2024-11-29)
|
|
146
147
|
|
|
@@ -84,7 +84,7 @@ udata/core/dataservices/api.py,sha256=LpRc1FNTA6jAOj1KsFme5TxVn4SgcUWlDBWi43H1eZ
|
|
|
84
84
|
udata/core/dataservices/apiv2.py,sha256=XIqJq58uLtxtt52iKYo7Fl0ZXv9Sz72uA7JIGwP8Qos,995
|
|
85
85
|
udata/core/dataservices/csv.py,sha256=pL3j8-_KZWJaX1xFyILXt9wBtXn9Cmov5FUQgd0lNh0,1040
|
|
86
86
|
udata/core/dataservices/factories.py,sha256=LDk8vvG0zhW8J-ZX5LoJQDU13pqeIyjQ05muuMro_eA,876
|
|
87
|
-
udata/core/dataservices/models.py,sha256=
|
|
87
|
+
udata/core/dataservices/models.py,sha256=cDG5jBCieDwEy7nzKGwovJ9lutubPl-RYw9vwGiYh1E,8921
|
|
88
88
|
udata/core/dataservices/permissions.py,sha256=98zM_R4v2ZtRubflB7ajaVQz-DVc-pZBMgtKUYy34oI,169
|
|
89
89
|
udata/core/dataservices/rdf.py,sha256=9dWSqONCD5m9HmAU_ndmEmG3F1IuRUOW6MWTmk2GEEI,6792
|
|
90
90
|
udata/core/dataservices/search.py,sha256=htjh3sq3tDuD2qwgRgZsW6ClrHLF6hMwYO4nfBO0Hr4,4171
|
|
@@ -110,9 +110,9 @@ udata/core/dataset/search.py,sha256=E7LqHBnq3sMefvmLwTpiw-Ovem2a3NJswHesRjctboE,
|
|
|
110
110
|
udata/core/dataset/signals.py,sha256=WN4sV-lJlNsRkhcnhoy0SYJvCoYmK_5QFYZd1u-h4gs,161
|
|
111
111
|
udata/core/dataset/tasks.py,sha256=F31TDKaawtOx6oxmWh9Vu24m0R4KVMouxFyAbaXVG6E,9609
|
|
112
112
|
udata/core/discussions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
113
|
-
udata/core/discussions/actions.py,sha256=
|
|
113
|
+
udata/core/discussions/actions.py,sha256=kjdBLDIeu0yWTSxQGgOpN1WoxUqbMygn4SiBk_S9T5I,1051
|
|
114
114
|
udata/core/discussions/api.py,sha256=5yMdKeWp0c9H2ipy5bXoMf82r3ULMIARhvuIdM-XJp0,9446
|
|
115
|
-
udata/core/discussions/constants.py,sha256=
|
|
115
|
+
udata/core/discussions/constants.py,sha256=8crl2Lmkv9dmJe4KACM0JJcpoHePmGtmvI6ixfvukhc,277
|
|
116
116
|
udata/core/discussions/csv.py,sha256=c7ZHMicIi8R0kvMjnsUooO0WlH0t90hJ9kO2mmFnUM0,672
|
|
117
117
|
udata/core/discussions/factories.py,sha256=CgQaUmmyDu90XtyBsqXVa-TmZMrN7Dwuu1Cnr5wNrVc,350
|
|
118
118
|
udata/core/discussions/forms.py,sha256=CalmOTslnfBY-SJatvqN2UjFJ-1S1rF57sbW8UbvmPE,838
|
|
@@ -121,7 +121,7 @@ udata/core/discussions/models.py,sha256=UkeEdzRkSrx9t2UiWow0GmtWh6R6_1p8p1olxS_g
|
|
|
121
121
|
udata/core/discussions/notifications.py,sha256=5MuoZDPmmvkloZ3i8I6TELgE1KXZ_cB9QiDerFBD9dM,1052
|
|
122
122
|
udata/core/discussions/permissions.py,sha256=r8uB_w29R6fICr0TUHIX_7JkXUpFcVBWWZRYW-xC0rY,640
|
|
123
123
|
udata/core/discussions/signals.py,sha256=tJ83RJIsBAny08Q6IDwehE6lDDRf6ynIFCl0WqnayoU,543
|
|
124
|
-
udata/core/discussions/tasks.py,sha256=
|
|
124
|
+
udata/core/discussions/tasks.py,sha256=QeLo1X6fNz2wl2rpZCu6NzAH83PgZqeMuwo4qBh7GXY,2741
|
|
125
125
|
udata/core/followers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
126
126
|
udata/core/followers/api.py,sha256=qeArJ-bqXlLHZWBZk2aVDX66FHS4TKH0ctpM9JRnIhU,2531
|
|
127
127
|
udata/core/followers/metrics.py,sha256=nKgoiM2Gu-XHrgEf9duW1My66zFSKbmw25BGqo5wWtY,190
|
|
@@ -709,9 +709,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=nGPoTSbeRlpCQGuxoJ7Oa650flpeeh
|
|
|
709
709
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=f-tilnngNNBEIQdXmm3GbdaLlvbwG9YLLwhqyRD5Lh4,44871
|
|
710
710
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=8RL_aEe-0QJdgY-TNMy7bS4z8X9IOK8-C076dxcp3As,28163
|
|
711
711
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=Cp0bKPeIbuAqvFeoey_9ItQbAHIeiFZPnZLa6A6JNbI,51363
|
|
712
|
-
udata-10.0.5.
|
|
713
|
-
udata-10.0.5.
|
|
714
|
-
udata-10.0.5.
|
|
715
|
-
udata-10.0.5.
|
|
716
|
-
udata-10.0.5.
|
|
717
|
-
udata-10.0.5.
|
|
712
|
+
udata-10.0.5.dev32808.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
713
|
+
udata-10.0.5.dev32808.dist-info/METADATA,sha256=RuoqpyAib_uJCVEasPzIGVckpLcTrU8upXi41O_LBUo,136348
|
|
714
|
+
udata-10.0.5.dev32808.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
715
|
+
udata-10.0.5.dev32808.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
|
|
716
|
+
udata-10.0.5.dev32808.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
717
|
+
udata-10.0.5.dev32808.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|