udata 9.0.1.dev29790__py2.py3-none-any.whl → 9.0.1.dev29853__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.
- udata/core/reports/api.py +5 -4
- udata/core/reports/constants.py +23 -21
- udata/core/reports/models.py +4 -3
- udata/tests/api/test_reports_api.py +1 -2
- {udata-9.0.1.dev29790.dist-info → udata-9.0.1.dev29853.dist-info}/METADATA +6 -6
- {udata-9.0.1.dev29790.dist-info → udata-9.0.1.dev29853.dist-info}/RECORD +10 -10
- {udata-9.0.1.dev29790.dist-info → udata-9.0.1.dev29853.dist-info}/LICENSE +0 -0
- {udata-9.0.1.dev29790.dist-info → udata-9.0.1.dev29853.dist-info}/WHEEL +0 -0
- {udata-9.0.1.dev29790.dist-info → udata-9.0.1.dev29853.dist-info}/entry_points.txt +0 -0
- {udata-9.0.1.dev29790.dist-info → udata-9.0.1.dev29853.dist-info}/top_level.txt +0 -0
udata/core/reports/api.py
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import mongoengine
|
|
1
2
|
from flask import request
|
|
2
3
|
from flask_login import current_user
|
|
3
|
-
import mongoengine
|
|
4
4
|
|
|
5
|
-
from udata.api import
|
|
5
|
+
from udata.api import API, api, fields
|
|
6
6
|
from udata.api_fields import patch
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
from .constants import reports_reasons_translations
|
|
9
|
+
from .models import Report
|
|
9
10
|
|
|
10
11
|
ns = api.namespace('reports', 'User reported objects related operations (beta)')
|
|
11
12
|
|
|
@@ -38,6 +39,6 @@ class ReportsAPI(API):
|
|
|
38
39
|
@ns.route('/reasons/', endpoint='reports_reasons')
|
|
39
40
|
class ReportsReasonsAPI(API):
|
|
40
41
|
@api.doc('list_reports_reasons')
|
|
41
|
-
@ns.response(200, "
|
|
42
|
+
@ns.response(200, "list of available reasons associated with their labels", fields.Raw)
|
|
42
43
|
def get(self):
|
|
43
44
|
return reports_reasons_translations()
|
udata/core/reports/constants.py
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
|
|
2
1
|
from udata.core.dataset.models import Dataset
|
|
3
2
|
from udata.i18n import lazy_gettext as _
|
|
4
3
|
|
|
4
|
+
REASON_PERSONAL_DATA = "personal_data"
|
|
5
|
+
REASON_EXPLICIT_CONTENT = "explicit_content"
|
|
6
|
+
REASON_ILLEGAL_CONTENT = "illegal_content"
|
|
7
|
+
REASON_OTHERS = "others"
|
|
8
|
+
REASON_SECURITY = "security"
|
|
9
|
+
REASON_SPAM = "spam"
|
|
5
10
|
|
|
6
|
-
REASON_SPAM = 'spam'
|
|
7
|
-
REASON_PERSONAL_DATA = 'personal_data'
|
|
8
|
-
REASON_EXPLICIT_CONTENT = 'explicit_content'
|
|
9
|
-
REASON_ILLEGAL_CONTENT = 'illegal_content'
|
|
10
|
-
REASON_SECURITY = 'security'
|
|
11
|
-
REASON_OTHERS = 'others'
|
|
12
11
|
|
|
13
|
-
def reports_reasons_translations():
|
|
14
|
-
|
|
15
|
-
This is a function to avoid creating the
|
|
12
|
+
def reports_reasons_translations() -> list:
|
|
13
|
+
"""
|
|
14
|
+
This is a function to avoid creating the list with a wrong lang
|
|
16
15
|
at the start of the app.
|
|
17
|
-
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
REASON_SECURITY: _(
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
"""
|
|
17
|
+
return [
|
|
18
|
+
{"value": REASON_EXPLICIT_CONTENT, "label": _("Explicit content")},
|
|
19
|
+
{"value": REASON_ILLEGAL_CONTENT, "label": _("Illegal content")},
|
|
20
|
+
{"value": REASON_OTHERS, "label": _("Others")},
|
|
21
|
+
{"value": REASON_PERSONAL_DATA, "label": _("Personal data")},
|
|
22
|
+
{"value": REASON_SECURITY, "label": _("Security")},
|
|
23
|
+
{"value": REASON_SPAM, "label": _("Spam")},
|
|
24
|
+
]
|
|
25
|
+
|
|
26
26
|
|
|
27
|
-
REPORT_REASONS_CHOICES = [
|
|
28
|
-
|
|
27
|
+
REPORT_REASONS_CHOICES: list[str] = [
|
|
28
|
+
item["value"] for item in reports_reasons_translations()
|
|
29
|
+
]
|
|
30
|
+
REPORTABLE_MODELS = [Dataset]
|
udata/core/reports/models.py
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
from datetime import datetime
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
from mongoengine import NULLIFY, signals
|
|
3
4
|
|
|
4
5
|
from udata.api_fields import field, generate_fields
|
|
5
|
-
from udata.core.
|
|
6
|
+
from udata.core.user.api_fields import user_ref_fields
|
|
6
7
|
from udata.core.user.models import User
|
|
7
8
|
from udata.mongo import db
|
|
8
|
-
from udata.core.user.api_fields import user_ref_fields
|
|
9
9
|
|
|
10
10
|
from .constants import REPORT_REASONS_CHOICES, REPORTABLE_MODELS
|
|
11
11
|
|
|
12
|
+
|
|
12
13
|
@generate_fields()
|
|
13
14
|
class Report(db.Document):
|
|
14
15
|
by = field(
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from typing import List
|
|
2
1
|
from flask import url_for
|
|
3
2
|
|
|
4
3
|
from udata.core.dataset.factories import (DatasetFactory)
|
|
@@ -44,7 +43,7 @@ class ReportsAPITest(APITestCase):
|
|
|
44
43
|
self.assert201(response)
|
|
45
44
|
self.assertEqual(Report.objects.count(), 2)
|
|
46
45
|
|
|
47
|
-
reports:
|
|
46
|
+
reports: list[Report] = list(Report.objects())
|
|
48
47
|
self.assertEqual(Dataset.__name__, reports[0].object_type)
|
|
49
48
|
self.assertEqual(illegal_dataset.id, reports[0].object_id)
|
|
50
49
|
self.assertEqual('This is not appropriate', reports[0].message)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 9.0.1.
|
|
3
|
+
Version: 9.0.1.dev29853
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -120,24 +120,24 @@ Requires-Dist: wtforms-json ==0.3.5
|
|
|
120
120
|
udata
|
|
121
121
|
=====
|
|
122
122
|
|
|
123
|
-
Customizable and skinnable social platform dedicated to (open)data.
|
|
123
|
+
Customizable and skinnable social platform dedicated to (open) data.
|
|
124
124
|
|
|
125
125
|
The [full documentation][readthedocs-url] is hosted on Read the Docs.
|
|
126
126
|
|
|
127
|
-
udata is maintained by [
|
|
128
|
-
|
|
127
|
+
udata is maintained by [data.gouv.fr](https://data.gouv.fr/), the
|
|
128
|
+
French public agency in charge of open data. data.gouv.fr is responsible
|
|
129
129
|
for publishing udata's roadmap and for building consensus around it.
|
|
130
130
|
|
|
131
131
|
It is collectively taken care of by members of the
|
|
132
132
|
[OpenDataTeam](https://github.com/opendatateam).
|
|
133
133
|
|
|
134
|
-
[readthedocs-url]: https://udata.readthedocs.io/en/
|
|
134
|
+
[readthedocs-url]: https://udata.readthedocs.io/en/stable/
|
|
135
135
|
|
|
136
136
|
# Changelog
|
|
137
137
|
|
|
138
138
|
## Current (in progress)
|
|
139
139
|
|
|
140
|
-
- Add reports backend [#3069](https://github.com/opendatateam/udata/pull/3069)
|
|
140
|
+
- Add reports backend [#3069](https://github.com/opendatateam/udata/pull/3069) and [#3078](https://github.com/opendatateam/udata/pull/3078)
|
|
141
141
|
- Improve `udata db check-integrity` (perfs, Sentry notifications…) [#3026](https://github.com/opendatateam/udata/pull/3026)
|
|
142
142
|
- Harvest dataservices [#3029](https://github.com/opendatateam/udata/pull/3029)
|
|
143
143
|
- Refactor catalog exports [#3052](https://github.com/opendatateam/udata/pull/3052)
|
|
@@ -162,9 +162,9 @@ udata/core/post/permissions.py,sha256=uofU0TehhOGYyUoRXf3wuy816_D3xwMmaJbDvV336s
|
|
|
162
162
|
udata/core/post/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
163
163
|
udata/core/post/tests/test_api.py,sha256=LSJQQDUtUVdpwZNpnJaX3yNQYyjkjTTyO7mHnR5DR_I,3948
|
|
164
164
|
udata/core/reports/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
165
|
-
udata/core/reports/api.py,sha256=
|
|
166
|
-
udata/core/reports/constants.py,sha256=
|
|
167
|
-
udata/core/reports/models.py,sha256=
|
|
165
|
+
udata/core/reports/api.py,sha256=2TMyOINU9h0OAsViqpfHz6Sj0dtn1dO0pNzOWED69FM,1349
|
|
166
|
+
udata/core/reports/constants.py,sha256=efuKjDtgb1jGWnLZvaloNscpH5u1gT1TSQbjKwLGuZA,989
|
|
167
|
+
udata/core/reports/models.py,sha256=eIQOKHJHaE5GeFguLsRJMUbHzdK77FXPpcsEBFcBYNg,1837
|
|
168
168
|
udata/core/reuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
169
169
|
udata/core/reuse/activities.py,sha256=rdl_CR3RJPBMonsHYmPnPVDvCYozNdXN2H1ILrTItNQ,1417
|
|
170
170
|
udata/core/reuse/api.py,sha256=72oJxmwziqvuFhxcuXy-5ckhQo39t65hp4eqvSqbQ6o,10237
|
|
@@ -605,7 +605,7 @@ udata/tests/api/test_fields.py,sha256=OW85Z5MES5HeWOpapeem8OvR1cIcrqW-xMWpdZO4LZ
|
|
|
605
605
|
udata/tests/api/test_follow_api.py,sha256=0h54P_Dfbo07u6tg0Rbai1WWgWb19ZLN2HGv4oLCWfg,3383
|
|
606
606
|
udata/tests/api/test_me_api.py,sha256=8OthqVYQKZrFoGuJ7zAvoLJx1IclPNzPdD5Tnzmh3rM,14163
|
|
607
607
|
udata/tests/api/test_organizations_api.py,sha256=buE1KdGIoJxfsj-ofz5CkMtgnARi38bXWR1jgPRkMzo,35732
|
|
608
|
-
udata/tests/api/test_reports_api.py,sha256=
|
|
608
|
+
udata/tests/api/test_reports_api.py,sha256=HOuEcKPd4pwH-h2nUITI_MzCLCcP2Hii5uiVYx23KxA,3439
|
|
609
609
|
udata/tests/api/test_reuses_api.py,sha256=GSoZ6SBRdMg6o0xKSQWtCSfvzqz_vZxERU567Rq1_GY,17009
|
|
610
610
|
udata/tests/api/test_swagger.py,sha256=tLg452rCD5Q0AgFXOVZKMM6jGiWwC5diX5PxbdYni0o,760
|
|
611
611
|
udata/tests/api/test_tags_api.py,sha256=xSIx_x5gqKz6BJCXKEsTqA_CR4BF1nG5NxEyfp9dy0o,2579
|
|
@@ -696,9 +696,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=Unzt8KXSviSWugimc9ficxraqJDz-h
|
|
|
696
696
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=O5E1eImTcE3v3m5Ub0UM9lKwK7bFGQ8_NLr1tZ4wjvs,44979
|
|
697
697
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=S2A9-Kq5YBc9klsEimF4JRm7ePxhcaM4_zeVEx3Em98,28500
|
|
698
698
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=a1c8DmzuWc-b-3kgXZl9n9aIODfttOYCN1F0pE6tPlA,51548
|
|
699
|
-
udata-9.0.1.
|
|
700
|
-
udata-9.0.1.
|
|
701
|
-
udata-9.0.1.
|
|
702
|
-
udata-9.0.1.
|
|
703
|
-
udata-9.0.1.
|
|
704
|
-
udata-9.0.1.
|
|
699
|
+
udata-9.0.1.dev29853.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
700
|
+
udata-9.0.1.dev29853.dist-info/METADATA,sha256=Q1A4YciYWt1y7RJpnvoChz7DzandYFB6-_u3BhH8zis,125706
|
|
701
|
+
udata-9.0.1.dev29853.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
702
|
+
udata-9.0.1.dev29853.dist-info/entry_points.txt,sha256=3SKiqVy4HUqxf6iWspgMqH8d88Htk6KoLbG1BU-UddQ,451
|
|
703
|
+
udata-9.0.1.dev29853.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
704
|
+
udata-9.0.1.dev29853.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|