udata 8.0.1.dev28979__py2.py3-none-any.whl → 8.0.1.dev29005__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/rdf.py +21 -1
- udata/core/user/api.py +10 -7
- udata/core/user/models.py +13 -2
- udata/harvest/tests/dcat/catalog.xml +1 -0
- udata/harvest/tests/test_dcat_backend.py +3 -0
- udata/settings.py +4 -1
- udata/static/chunks/{11.7266fef2dddc1db403d9.js → 11.ae54612e36c6d46f85db.js} +3 -3
- udata/static/chunks/{11.7266fef2dddc1db403d9.js.map → 11.ae54612e36c6d46f85db.js.map} +1 -1
- udata/static/chunks/{13.91b177d7d531fd55cf5d.js → 13.d8ccb992a49875966313.js} +2 -2
- udata/static/chunks/{13.91b177d7d531fd55cf5d.js.map → 13.d8ccb992a49875966313.js.map} +1 -1
- udata/static/chunks/{16.e866757bab9f6b0a3f1b.js → 16.4565605e68bab129a471.js} +2 -2
- udata/static/chunks/{16.e866757bab9f6b0a3f1b.js.map → 16.4565605e68bab129a471.js.map} +1 -1
- udata/static/chunks/{19.619b83ac597516dcd03e.js → 19.f993a75d5bfe2382548d.js} +3 -3
- udata/static/chunks/{19.619b83ac597516dcd03e.js.map → 19.f993a75d5bfe2382548d.js.map} +1 -1
- udata/static/chunks/{5.3dc97ea195d251881552.js → 5.ada3202d02917ce0edea.js} +3 -3
- udata/static/chunks/{5.3dc97ea195d251881552.js.map → 5.ada3202d02917ce0edea.js.map} +1 -1
- udata/static/chunks/{6.f84539bd4c419b36cc19.js → 6.cad898a38692eda28965.js} +3 -3
- udata/static/chunks/{6.f84539bd4c419b36cc19.js.map → 6.cad898a38692eda28965.js.map} +1 -1
- udata/static/chunks/{9.07503e7f7ec02919f696.js → 9.d5b992e9ef51921aeb57.js} +2 -2
- udata/static/chunks/{9.07503e7f7ec02919f696.js.map → 9.d5b992e9ef51921aeb57.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tests/api/test_user_api.py +18 -4
- {udata-8.0.1.dev28979.dist-info → udata-8.0.1.dev29005.dist-info}/METADATA +3 -1
- {udata-8.0.1.dev28979.dist-info → udata-8.0.1.dev29005.dist-info}/RECORD +29 -29
- {udata-8.0.1.dev28979.dist-info → udata-8.0.1.dev29005.dist-info}/LICENSE +0 -0
- {udata-8.0.1.dev28979.dist-info → udata-8.0.1.dev29005.dist-info}/WHEEL +0 -0
- {udata-8.0.1.dev28979.dist-info → udata-8.0.1.dev29005.dist-info}/entry_points.txt +0 -0
- {udata-8.0.1.dev28979.dist-info → udata-8.0.1.dev29005.dist-info}/top_level.txt +0 -0
udata/core/dataset/rdf.py
CHANGED
|
@@ -76,6 +76,16 @@ EU_RDF_REQUENCIES = {
|
|
|
76
76
|
EUFREQ.NEVER: 'punctual',
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
# Map High Value Datasets URIs to keyword categories
|
|
80
|
+
EU_HVD_CATEGORIES = {
|
|
81
|
+
"http://data.europa.eu/bna/c_164e0bf5": "Météorologiques",
|
|
82
|
+
"http://data.europa.eu/bna/c_a9135398": "Entreprises et propriété d'entreprises",
|
|
83
|
+
"http://data.europa.eu/bna/c_ac64a52d": "Géospatiales",
|
|
84
|
+
"http://data.europa.eu/bna/c_b79e35eb": "Mobilité",
|
|
85
|
+
"http://data.europa.eu/bna/c_dd313021": "Observation de la terre et environnement",
|
|
86
|
+
"http://data.europa.eu/bna/c_e1da4e07": "Statistiques"
|
|
87
|
+
}
|
|
88
|
+
|
|
79
89
|
|
|
80
90
|
class HTMLDetector(HTMLParser):
|
|
81
91
|
def __init__(self, *args, **kwargs):
|
|
@@ -469,9 +479,19 @@ def remote_url_from_rdf(rdf):
|
|
|
469
479
|
|
|
470
480
|
|
|
471
481
|
def theme_labels_from_rdf(rdf):
|
|
482
|
+
'''
|
|
483
|
+
Get theme labels to use as keywords.
|
|
484
|
+
Map HVD keywords from known URIs resources if HVD support is activated.
|
|
485
|
+
'''
|
|
472
486
|
for theme in rdf.objects(DCAT.theme):
|
|
473
487
|
if isinstance(theme, RdfResource):
|
|
474
|
-
|
|
488
|
+
uri = theme.identifier.toPython()
|
|
489
|
+
if current_app.config['HVD_SUPPORT'] and uri in EU_HVD_CATEGORIES:
|
|
490
|
+
label = EU_HVD_CATEGORIES[uri]
|
|
491
|
+
# Additionnally yield hvd keyword
|
|
492
|
+
yield 'hvd'
|
|
493
|
+
else:
|
|
494
|
+
label = rdf_value(theme, SKOS.prefLabel)
|
|
475
495
|
else:
|
|
476
496
|
label = theme.toPython()
|
|
477
497
|
if label:
|
udata/core/user/api.py
CHANGED
|
@@ -269,6 +269,12 @@ class UserAvatarAPI(API):
|
|
|
269
269
|
return {'image': user.avatar}
|
|
270
270
|
|
|
271
271
|
|
|
272
|
+
|
|
273
|
+
delete_parser = api.parser()
|
|
274
|
+
delete_parser.add_argument(
|
|
275
|
+
'no_mail', type=bool, help='Do not send a mail to notify the user of the deletion',
|
|
276
|
+
location='args', default=False)
|
|
277
|
+
|
|
272
278
|
@ns.route('/<user:user>/', endpoint='user')
|
|
273
279
|
@api.response(404, 'User not found')
|
|
274
280
|
@api.response(410, 'User is not active or has been deleted')
|
|
@@ -297,22 +303,19 @@ class UserAPI(API):
|
|
|
297
303
|
|
|
298
304
|
@api.secure(admin_permission)
|
|
299
305
|
@api.doc('delete_user')
|
|
306
|
+
@api.expect(delete_parser)
|
|
300
307
|
@api.response(204, 'Object deleted')
|
|
301
308
|
@api.response(403, 'When trying to delete yourself')
|
|
302
309
|
def delete(self, user):
|
|
303
310
|
'''Delete a user given its identifier'''
|
|
311
|
+
args = delete_parser.parse_args()
|
|
304
312
|
if user.deleted:
|
|
305
313
|
api.abort(410, 'User has already been deleted')
|
|
306
314
|
if user == current_user._get_current_object():
|
|
307
315
|
api.abort(403, 'You cannot delete yourself with this API. ' +
|
|
308
316
|
'Use the "me" API instead.')
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
storage.delete(user.avatar.filename)
|
|
312
|
-
storage.delete(user.avatar.original)
|
|
313
|
-
for key, value in user.avatar.thumbnails.items():
|
|
314
|
-
storage.delete(value)
|
|
315
|
-
user.mark_as_deleted()
|
|
317
|
+
|
|
318
|
+
user.mark_as_deleted(notify=not args['no_mail'])
|
|
316
319
|
return '', 204
|
|
317
320
|
|
|
318
321
|
|
udata/core/user/models.py
CHANGED
|
@@ -13,6 +13,7 @@ from mongoengine.signals import pre_save, post_save
|
|
|
13
13
|
from werkzeug.utils import cached_property
|
|
14
14
|
|
|
15
15
|
from udata import mail
|
|
16
|
+
from udata.core import storages
|
|
16
17
|
from udata.uris import endpoint_for
|
|
17
18
|
from udata.frontend.markdown import mdstrip
|
|
18
19
|
from udata.i18n import lazy_gettext as _
|
|
@@ -233,7 +234,15 @@ class User(WithMetrics, UserMixin, db.Document):
|
|
|
233
234
|
raise NotImplementedError('''This method should not be using directly.
|
|
234
235
|
Use `mark_as_deleted` (or `_delete` if you know what you're doing)''')
|
|
235
236
|
|
|
236
|
-
def mark_as_deleted(self):
|
|
237
|
+
def mark_as_deleted(self, notify: bool = True):
|
|
238
|
+
if self.avatar.filename is not None:
|
|
239
|
+
storage = storages.avatars
|
|
240
|
+
storage.delete(self.avatar.filename)
|
|
241
|
+
storage.delete(self.avatar.original)
|
|
242
|
+
for key, value in self.avatar.thumbnails.items():
|
|
243
|
+
storage.delete(value)
|
|
244
|
+
|
|
245
|
+
|
|
237
246
|
copied_user = copy(self)
|
|
238
247
|
self.email = '{}@deleted'.format(self.id)
|
|
239
248
|
self.slug = 'deleted'
|
|
@@ -270,7 +279,9 @@ class User(WithMetrics, UserMixin, db.Document):
|
|
|
270
279
|
from udata.models import ContactPoint
|
|
271
280
|
ContactPoint.objects(owner=self).delete()
|
|
272
281
|
|
|
273
|
-
|
|
282
|
+
|
|
283
|
+
if notify:
|
|
284
|
+
mail.send(_('Account deletion'), copied_user, 'account_deleted')
|
|
274
285
|
|
|
275
286
|
def count_datasets(self):
|
|
276
287
|
from udata.models import Dataset
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
<dcterms:issued rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2016-12-14T18:59:02.737480</dcterms:issued>
|
|
24
24
|
<dcterms:description>Dataset 3 description</dcterms:description>
|
|
25
25
|
<dcat:keyword>Tag 1</dcat:keyword>
|
|
26
|
+
<dcat:theme rdf:resource="http://data.europa.eu/bna/c_dd313021"/>
|
|
26
27
|
<dcat:distribution rdf:resource="datasets/3/resources/1"/>
|
|
27
28
|
<dct:license>Licence Ouverte Version 2.0</dct:license>
|
|
28
29
|
<dct:accessRights rdf:resource="http://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess/INSPIRE_Directive_Article13_1e"/>
|
|
@@ -440,6 +440,9 @@ class DcatBackendTest:
|
|
|
440
440
|
assert dataset.extras["harvest"]["dct:accessRights"] == "http://inspire.ec.europa.eu/metadata-codelist/LimitationsOnPublicAccess/INSPIRE_Directive_Article13_1e"
|
|
441
441
|
assert dataset.extras["harvest"]["dct:provenance"] == ["Description de la provenance des données"]
|
|
442
442
|
|
|
443
|
+
assert 'observation-de-la-terre-et-environnement' in dataset.tags
|
|
444
|
+
assert 'hvd' in dataset.tags
|
|
445
|
+
|
|
443
446
|
dataset = Dataset.objects.get(harvest__dct_identifier='1')
|
|
444
447
|
# test html abstract description support
|
|
445
448
|
assert dataset.description == '# h1 title\n\n## h2 title\n\n **and bold text**'
|
udata/settings.py
CHANGED
|
@@ -269,7 +269,10 @@ class Defaults(object):
|
|
|
269
269
|
# S3 connection details
|
|
270
270
|
S3_URL = None
|
|
271
271
|
S3_ACCESS_KEY_ID = None
|
|
272
|
-
S3_SECRET_ACCESS_KEY = None
|
|
272
|
+
S3_SECRET_ACCESS_KEY = None
|
|
273
|
+
|
|
274
|
+
# Specific support for hvd (map HVD categories URIs to keywords)
|
|
275
|
+
HVD_SUPPORT = True
|
|
273
276
|
|
|
274
277
|
ACTIVATE_TERRITORIES = False
|
|
275
278
|
# The order is important to compute parents/children, smaller first.
|