udata 10.3.1.dev34788__py2.py3-none-any.whl → 10.3.1.dev34819__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/api.py +44 -2
- udata/core/dataset/tasks.py +1 -1
- udata/static/chunks/{10.471164b2a9fe15614797.js → 10.8ca60413647062717b1e.js} +3 -3
- udata/static/chunks/{10.471164b2a9fe15614797.js.map → 10.8ca60413647062717b1e.js.map} +1 -1
- udata/static/chunks/{11.51d706fb9521c16976bc.js → 11.b6f741fcc366abfad9c4.js} +3 -3
- udata/static/chunks/{11.51d706fb9521c16976bc.js.map → 11.b6f741fcc366abfad9c4.js.map} +1 -1
- udata/static/chunks/{13.f29411b06be1883356a3.js → 13.2d06442dd9a05d9777b5.js} +2 -2
- udata/static/chunks/{13.f29411b06be1883356a3.js.map → 13.2d06442dd9a05d9777b5.js.map} +1 -1
- udata/static/chunks/{17.3bd0340930d4a314ce9c.js → 17.e8e4caaad5cb0cc0bacc.js} +2 -2
- udata/static/chunks/{17.3bd0340930d4a314ce9c.js.map → 17.e8e4caaad5cb0cc0bacc.js.map} +1 -1
- udata/static/chunks/{19.8da42e8359d72afc2618.js → 19.f03a102365af4315f9db.js} +3 -3
- udata/static/chunks/{19.8da42e8359d72afc2618.js.map → 19.f03a102365af4315f9db.js.map} +1 -1
- udata/static/chunks/{8.54e44b102164ae5e7a67.js → 8.778091d55cd8ea39af6b.js} +2 -2
- udata/static/chunks/{8.54e44b102164ae5e7a67.js.map → 8.778091d55cd8ea39af6b.js.map} +1 -1
- udata/static/chunks/{9.07515e5187f475bce828.js → 9.033d7e190ca9e226a5d0.js} +3 -3
- udata/static/chunks/{9.07515e5187f475bce828.js.map → 9.033d7e190ca9e226a5d0.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tests/api/test_datasets_api.py +95 -1
- {udata-10.3.1.dev34788.dist-info → udata-10.3.1.dev34819.dist-info}/METADATA +3 -2
- {udata-10.3.1.dev34788.dist-info → udata-10.3.1.dev34819.dist-info}/RECORD +25 -25
- {udata-10.3.1.dev34788.dist-info → udata-10.3.1.dev34819.dist-info}/LICENSE +0 -0
- {udata-10.3.1.dev34788.dist-info → udata-10.3.1.dev34819.dist-info}/WHEEL +0 -0
- {udata-10.3.1.dev34788.dist-info → udata-10.3.1.dev34819.dist-info}/entry_points.txt +0 -0
- {udata-10.3.1.dev34788.dist-info → udata-10.3.1.dev34819.dist-info}/top_level.txt +0 -0
udata/core/dataset/api.py
CHANGED
|
@@ -24,6 +24,7 @@ from datetime import datetime
|
|
|
24
24
|
import mongoengine
|
|
25
25
|
from bson.objectid import ObjectId
|
|
26
26
|
from flask import abort, current_app, make_response, redirect, request, url_for
|
|
27
|
+
from flask_restx.inputs import boolean
|
|
27
28
|
from flask_security import current_user
|
|
28
29
|
from mongoengine.queryset.visitor import Q
|
|
29
30
|
|
|
@@ -98,7 +99,12 @@ class DatasetApiParser(ModelApiParser):
|
|
|
98
99
|
super().__init__()
|
|
99
100
|
self.parser.add_argument("tag", type=str, location="args", action="append")
|
|
100
101
|
self.parser.add_argument("license", type=str, location="args")
|
|
101
|
-
self.parser.add_argument(
|
|
102
|
+
self.parser.add_argument(
|
|
103
|
+
"featured",
|
|
104
|
+
type=boolean,
|
|
105
|
+
location="args",
|
|
106
|
+
help="If set to true, it will filter on featured datasets only. If set to false, it will exclude featured datasets.",
|
|
107
|
+
)
|
|
102
108
|
self.parser.add_argument("geozone", type=str, location="args")
|
|
103
109
|
self.parser.add_argument("granularity", type=str, location="args")
|
|
104
110
|
self.parser.add_argument("temporal_coverage", type=str, location="args")
|
|
@@ -116,6 +122,24 @@ class DatasetApiParser(ModelApiParser):
|
|
|
116
122
|
self.parser.add_argument("topic", type=str, location="args")
|
|
117
123
|
self.parser.add_argument("credit", type=str, location="args")
|
|
118
124
|
self.parser.add_argument("dataservice", type=str, location="args")
|
|
125
|
+
self.parser.add_argument(
|
|
126
|
+
"archived",
|
|
127
|
+
type=boolean,
|
|
128
|
+
location="args",
|
|
129
|
+
help="If set to true, it will filter on archived datasets only. If set to false, it will exclude archived datasets. User must be authenticated and results are limited to user visibility",
|
|
130
|
+
)
|
|
131
|
+
self.parser.add_argument(
|
|
132
|
+
"deleted",
|
|
133
|
+
type=boolean,
|
|
134
|
+
location="args",
|
|
135
|
+
help="If set to true, it will filter on deleted datasets only. If set to false, it will exclude deleted datasets. User must be authenticated and results are limited to user visibility",
|
|
136
|
+
)
|
|
137
|
+
self.parser.add_argument(
|
|
138
|
+
"private",
|
|
139
|
+
type=boolean,
|
|
140
|
+
location="args",
|
|
141
|
+
help="If set to true, it will filter on private datasets only. If set to false, it will exclude private datasets. User must be authenticated and results are limited to user visibility",
|
|
142
|
+
)
|
|
119
143
|
|
|
120
144
|
@staticmethod
|
|
121
145
|
def parse_filters(datasets, args):
|
|
@@ -139,7 +163,7 @@ class DatasetApiParser(ModelApiParser):
|
|
|
139
163
|
temporal_coverage__start__gte=args["temporal_coverage"][:9],
|
|
140
164
|
temporal_coverage__start__lte=args["temporal_coverage"][11:],
|
|
141
165
|
)
|
|
142
|
-
if args.get("featured"):
|
|
166
|
+
if args.get("featured") is not None:
|
|
143
167
|
datasets = datasets.filter(featured=args["featured"])
|
|
144
168
|
if args.get("organization"):
|
|
145
169
|
if not ObjectId.is_valid(args["organization"]):
|
|
@@ -176,6 +200,24 @@ class DatasetApiParser(ModelApiParser):
|
|
|
176
200
|
pass
|
|
177
201
|
else:
|
|
178
202
|
datasets = datasets.filter(id__in=[d.id for d in dataservice.datasets])
|
|
203
|
+
if args.get("archived") is not None:
|
|
204
|
+
if current_user.is_anonymous:
|
|
205
|
+
abort(401)
|
|
206
|
+
if args["archived"] is True:
|
|
207
|
+
datasets = datasets.filter(archived__exists=True)
|
|
208
|
+
else:
|
|
209
|
+
datasets = datasets.filter(archived=None)
|
|
210
|
+
if args.get("deleted") is not None:
|
|
211
|
+
if current_user.is_anonymous:
|
|
212
|
+
abort(401)
|
|
213
|
+
if args["deleted"] is True:
|
|
214
|
+
datasets = datasets.filter(deleted__exists=True)
|
|
215
|
+
else:
|
|
216
|
+
datasets = datasets.filter(deleted=None)
|
|
217
|
+
if args.get("private") is not None:
|
|
218
|
+
if current_user.is_anonymous:
|
|
219
|
+
abort(401)
|
|
220
|
+
datasets = datasets.filter(private=args["private"])
|
|
179
221
|
return datasets
|
|
180
222
|
|
|
181
223
|
|
udata/core/dataset/tasks.py
CHANGED
|
@@ -140,7 +140,7 @@ def get_queryset(model_cls):
|
|
|
140
140
|
if model_cls.__name__ == "Resource":
|
|
141
141
|
model_cls = getattr(udata_models, "Dataset")
|
|
142
142
|
params = {}
|
|
143
|
-
attrs = ("private", "deleted")
|
|
143
|
+
attrs = ("private", "deleted", "deleted_at")
|
|
144
144
|
for attr in attrs:
|
|
145
145
|
if getattr(model_cls, attr, None):
|
|
146
146
|
params[attr] = False
|