udata 9.1.4.dev31257__py2.py3-none-any.whl → 9.1.4.dev31267__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/user/api.py +22 -1
- udata/static/chunks/{10.1d9b1714c0289863ba0a.js → 10.c1c9496ebfc8949f3de2.js} +3 -3
- udata/static/chunks/{10.1d9b1714c0289863ba0a.js.map → 10.c1c9496ebfc8949f3de2.js.map} +1 -1
- udata/static/chunks/{11.b6991d2651a318d28ccc.js → 11.16618d9eedd3f6a7a3c2.js} +3 -3
- udata/static/chunks/{11.b6991d2651a318d28ccc.js.map → 11.16618d9eedd3f6a7a3c2.js.map} +1 -1
- udata/static/chunks/{13.413af7c95ac0ab6c909a.js → 13.9cfb8ee33c4d62e33f8a.js} +2 -2
- udata/static/chunks/{13.413af7c95ac0ab6c909a.js.map → 13.9cfb8ee33c4d62e33f8a.js.map} +1 -1
- udata/static/chunks/{16.133ce8c70b1e42c9e717.js → 16.d1de045f4bc4b5acdf6b.js} +2 -2
- udata/static/chunks/{16.133ce8c70b1e42c9e717.js.map → 16.d1de045f4bc4b5acdf6b.js.map} +1 -1
- udata/static/chunks/{19.28f355064e529318c9b1.js → 19.f1ff6cd5816f2d9debc4.js} +3 -3
- udata/static/chunks/{19.28f355064e529318c9b1.js.map → 19.f1ff6cd5816f2d9debc4.js.map} +1 -1
- udata/static/chunks/{8.95c59b717494bac4ce43.js → 8.b50a30118e9e2e1ab436.js} +2 -2
- udata/static/chunks/{8.95c59b717494bac4ce43.js.map → 8.b50a30118e9e2e1ab436.js.map} +1 -1
- udata/static/chunks/{9.5009f558f2268bbe4094.js → 9.8ad948dd393d38f07a7a.js} +3 -3
- udata/static/chunks/{9.5009f558f2268bbe4094.js.map → 9.8ad948dd393d38f07a7a.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tests/api/test_user_api.py +11 -0
- {udata-9.1.4.dev31257.dist-info → udata-9.1.4.dev31267.dist-info}/METADATA +1 -1
- {udata-9.1.4.dev31257.dist-info → udata-9.1.4.dev31267.dist-info}/RECORD +24 -24
- {udata-9.1.4.dev31257.dist-info → udata-9.1.4.dev31267.dist-info}/LICENSE +0 -0
- {udata-9.1.4.dev31257.dist-info → udata-9.1.4.dev31267.dist-info}/WHEEL +0 -0
- {udata-9.1.4.dev31257.dist-info → udata-9.1.4.dev31267.dist-info}/entry_points.txt +0 -0
- {udata-9.1.4.dev31257.dist-info → udata-9.1.4.dev31267.dist-info}/top_level.txt +0 -0
udata/core/user/api.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from typing import Optional
|
|
2
|
+
|
|
1
3
|
from flask_security import current_user, logout_user
|
|
2
4
|
from slugify import slugify
|
|
3
5
|
|
|
@@ -359,8 +361,27 @@ suggest_parser = api.parser()
|
|
|
359
361
|
suggest_parser.add_argument(
|
|
360
362
|
"q", help="The string to autocomplete/suggest", location="args", required=True
|
|
361
363
|
)
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
def suggest_size(value: str) -> Optional[int]:
|
|
367
|
+
"""Parse an integer that must be between 1 and 20."""
|
|
368
|
+
help_message = "The size must be an integer between 1 and 20."
|
|
369
|
+
try:
|
|
370
|
+
parsed = int(value)
|
|
371
|
+
except ValueError:
|
|
372
|
+
raise ValueError(help_message)
|
|
373
|
+
|
|
374
|
+
if parsed < 1 or parsed > 20:
|
|
375
|
+
raise ValueError(help_message)
|
|
376
|
+
return parsed
|
|
377
|
+
|
|
378
|
+
|
|
362
379
|
suggest_parser.add_argument(
|
|
363
|
-
"size",
|
|
380
|
+
"size",
|
|
381
|
+
type=suggest_size,
|
|
382
|
+
help="The amount of suggestion to fetch (between 1 and 20)",
|
|
383
|
+
location="args",
|
|
384
|
+
default=10,
|
|
364
385
|
)
|
|
365
386
|
|
|
366
387
|
|