oarepo-runtime 1.5.73__py3-none-any.whl → 1.5.74__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.
- oarepo_runtime/services/results.py +39 -0
- oarepo_runtime/services/schema/validation.py +12 -2
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +5 -0
- oarepo_runtime/translations/en/LC_MESSAGES/messages.mo +0 -0
- oarepo_runtime/translations/en/LC_MESSAGES/messages.po +5 -0
- oarepo_runtime/translations/messages.pot +20 -14
- {oarepo_runtime-1.5.73.dist-info → oarepo_runtime-1.5.74.dist-info}/METADATA +1 -1
- {oarepo_runtime-1.5.73.dist-info → oarepo_runtime-1.5.74.dist-info}/RECORD +13 -14
- {oarepo_runtime-1.5.73.dist-info → oarepo_runtime-1.5.74.dist-info}/entry_points.txt +3 -0
- oarepo_runtime/translations/jinjax_messages.jinja +0 -0
- {oarepo_runtime-1.5.73.dist-info → oarepo_runtime-1.5.74.dist-info}/LICENSE +0 -0
- {oarepo_runtime-1.5.73.dist-info → oarepo_runtime-1.5.74.dist-info}/WHEEL +0 -0
- {oarepo_runtime-1.5.73.dist-info → oarepo_runtime-1.5.74.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,4 @@
|
|
1
|
+
from invenio_records_resources.errors import _iter_errors_dict
|
1
2
|
from invenio_records_resources.services.records.results import (
|
2
3
|
RecordItem as BaseRecordItem,
|
3
4
|
)
|
@@ -30,6 +31,44 @@ class RecordItem(BaseRecordItem):
|
|
30
31
|
)
|
31
32
|
return _data
|
32
33
|
|
34
|
+
@property
|
35
|
+
def errors(self):
|
36
|
+
return postprocess_errors(self._errors)
|
37
|
+
|
38
|
+
def to_dict(self):
|
39
|
+
"""Get a dictionary for the record."""
|
40
|
+
res = self.data
|
41
|
+
if self._errors:
|
42
|
+
res["errors"] = self.errors
|
43
|
+
return res
|
44
|
+
|
45
|
+
|
46
|
+
def postprocess_error_messages(field_path: str, messages: any):
|
47
|
+
"""Postprocess error messages, looking for those that were not correctly processed by marshmallow/invenio.
|
48
|
+
|
49
|
+
"""
|
50
|
+
if not isinstance(messages, list):
|
51
|
+
yield {"field": field_path, "messages": messages}
|
52
|
+
else:
|
53
|
+
str_messages = [ msg for msg in messages if isinstance(msg, str) ]
|
54
|
+
non_str_messages = [ msg for msg in messages if not isinstance(msg, str) ]
|
55
|
+
|
56
|
+
if str_messages:
|
57
|
+
yield {"field": field_path, "messages": str_messages}
|
58
|
+
else:
|
59
|
+
for non_str_msg in non_str_messages:
|
60
|
+
yield from _iter_errors_dict(non_str_msg, field_path)
|
61
|
+
|
62
|
+
|
63
|
+
def postprocess_errors(errors: list[dict]):
|
64
|
+
"""Postprocess errors."""
|
65
|
+
converted_errors = []
|
66
|
+
for error in errors:
|
67
|
+
if error.get("messages"):
|
68
|
+
converted_errors.extend(postprocess_error_messages(error["field"], error["messages"]))
|
69
|
+
else:
|
70
|
+
converted_errors.append(error)
|
71
|
+
return converted_errors
|
33
72
|
|
34
73
|
class RecordList(BaseRecordList):
|
35
74
|
components = []
|
@@ -6,14 +6,24 @@ from idutils import normalize_pid
|
|
6
6
|
from marshmallow.exceptions import ValidationError
|
7
7
|
from marshmallow_utils.fields.edtfdatestring import EDTFValidator
|
8
8
|
|
9
|
+
from invenio_i18n import gettext as _
|
10
|
+
|
9
11
|
|
10
12
|
def validate_identifier(value):
|
11
13
|
try:
|
12
|
-
value["identifier"]
|
14
|
+
original_identifier = (value["identifier"] or '').strip()
|
15
|
+
normalized_identifier = normalize_pid(
|
13
16
|
value["identifier"], value["scheme"].lower()
|
14
17
|
)
|
18
|
+
if original_identifier and not normalized_identifier:
|
19
|
+
# the normalize_pid library has problems with isbn - does not raise an exception
|
20
|
+
# but returns an empty string
|
21
|
+
raise ValueError()
|
22
|
+
value["identifier"] = normalized_identifier
|
15
23
|
except:
|
16
|
-
raise ValidationError(
|
24
|
+
raise ValidationError({
|
25
|
+
"identifier": _("Invalid value %(identifier)s of identifier type %(type)s") % {"identifier": value['identifier'], "type": value['scheme']}
|
26
|
+
})
|
17
27
|
return value
|
18
28
|
|
19
29
|
|
Binary file
|
@@ -46,3 +46,8 @@ msgstr "Dle názvu"
|
|
46
46
|
#: oarepo_runtime/services/schema/ui.py:114
|
47
47
|
msgid "False"
|
48
48
|
msgstr "Ne"
|
49
|
+
|
50
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/validation.py:19
|
51
|
+
#, python-format
|
52
|
+
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
53
|
+
msgstr "%(type)s: Neplatná hodnota '%(identifier)s'"
|
Binary file
|
@@ -45,3 +45,8 @@ msgstr ""
|
|
45
45
|
#: oarepo_runtime/services/schema/ui.py:114
|
46
46
|
msgid "False"
|
47
47
|
msgstr ""
|
48
|
+
|
49
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/validation.py:19
|
50
|
+
#, python-format
|
51
|
+
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
52
|
+
msgstr ""
|
@@ -1,50 +1,56 @@
|
|
1
1
|
# Translations template for PROJECT.
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2024 ORGANIZATION
|
3
3
|
# This file is distributed under the same license as the PROJECT project.
|
4
|
-
# FIRST AUTHOR <EMAIL@ADDRESS>,
|
4
|
+
# FIRST AUTHOR <EMAIL@ADDRESS>, 2024.
|
5
5
|
#
|
6
6
|
#, fuzzy
|
7
7
|
msgid ""
|
8
8
|
msgstr ""
|
9
9
|
"Project-Id-Version: PROJECT VERSION\n"
|
10
10
|
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
|
11
|
-
"POT-Creation-Date:
|
11
|
+
"POT-Creation-Date: 2024-11-28 10:16+0100\n"
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
15
15
|
"MIME-Version: 1.0\n"
|
16
16
|
"Content-Type: text/plain; charset=utf-8\n"
|
17
17
|
"Content-Transfer-Encoding: 8bit\n"
|
18
|
-
"Generated-By: Babel 2.
|
18
|
+
"Generated-By: Babel 2.15.0\n"
|
19
19
|
|
20
|
-
#:
|
20
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:60
|
21
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:146
|
21
22
|
msgid "By Title"
|
22
23
|
msgstr ""
|
23
24
|
|
24
|
-
#: oarepo_runtime/services/search.py:
|
25
|
-
#: oarepo_runtime/translations/default_translations.py:5
|
25
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:64
|
26
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:5
|
26
27
|
msgid "Best match"
|
27
28
|
msgstr ""
|
28
29
|
|
29
|
-
#: oarepo_runtime/services/search.py:
|
30
|
-
#: oarepo_runtime/translations/default_translations.py:3
|
30
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:68
|
31
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:3
|
31
32
|
msgid "Newest"
|
32
33
|
msgstr ""
|
33
34
|
|
34
|
-
#: oarepo_runtime/services/search.py:
|
35
|
-
#: oarepo_runtime/translations/default_translations.py:4
|
35
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:72
|
36
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:4
|
36
37
|
msgid "Oldest"
|
37
38
|
msgstr ""
|
38
39
|
|
39
|
-
#: oarepo_runtime/services/schema/ui.py:
|
40
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:123
|
40
41
|
msgid "True"
|
41
42
|
msgstr ""
|
42
43
|
|
43
|
-
#: oarepo_runtime/services/schema/ui.py:
|
44
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:123
|
44
45
|
msgid "False"
|
45
46
|
msgstr ""
|
46
47
|
|
47
|
-
#: oarepo_runtime/
|
48
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/validation.py:19
|
49
|
+
#, python-format
|
50
|
+
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
51
|
+
msgstr ""
|
52
|
+
|
53
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:6
|
48
54
|
msgid "Contact"
|
49
55
|
msgstr ""
|
50
56
|
|
@@ -73,7 +73,7 @@ oarepo_runtime/resources/localized_ui_json_serializer.py,sha256=3V9cJaG_e1PMXKVX
|
|
73
73
|
oarepo_runtime/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
74
74
|
oarepo_runtime/services/components.py,sha256=k--zu1RinwoKzg5qHp4H-Ddp9AFyjMJ97fydQ0DvI-A,4238
|
75
75
|
oarepo_runtime/services/generators.py,sha256=j87HitHA_w2awsz0C5IAAJ0qjg9JMtvdO3dvh6FQyfg,250
|
76
|
-
oarepo_runtime/services/results.py,sha256=
|
76
|
+
oarepo_runtime/services/results.py,sha256=HVBEPAMFwwCJDqBhaP3t3ekH1CpNDtE6ovVNKgWxuw8,5409
|
77
77
|
oarepo_runtime/services/search.py,sha256=9xGTN5Yg6eTdptQ9qjO_umbacf9ooMuHYGXWYfla4-M,6227
|
78
78
|
oarepo_runtime/services/config/__init__.py,sha256=dtlD84pJ6xI77UF22IPrCOt7tHD3g5DAEDApUdjDVFE,406
|
79
79
|
oarepo_runtime/services/config/permissions_presets.py,sha256=zApeA-2DYAlD--SzVz3vq_OFjq48Ko0pe08e4o2vxr4,6114
|
@@ -116,14 +116,13 @@ oarepo_runtime/services/schema/oneofschema.py,sha256=GnWH4Or_G5M0NgSmCoqMI6PBrJg
|
|
116
116
|
oarepo_runtime/services/schema/polymorphic.py,sha256=bAbUoTIeDBiJPYPhpLEKKZekEdkHlpqkmNxk1hN3PDw,564
|
117
117
|
oarepo_runtime/services/schema/rdm.py,sha256=XQ5p72Q_WVRTQkFeJvDiave8F5YSXU05IduTuYFO4gA,574
|
118
118
|
oarepo_runtime/services/schema/ui.py,sha256=xQgW-zLyZoHldGw47uVtXQj-5LexVNKTholyq4MiBZo,3777
|
119
|
-
oarepo_runtime/services/schema/validation.py,sha256=
|
119
|
+
oarepo_runtime/services/schema/validation.py,sha256=g2lpFwgQygWdLgq5bRvLAjVqXVOJpfVJ7umDp5xEGRU,1849
|
120
120
|
oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
|
121
|
-
oarepo_runtime/translations/
|
122
|
-
oarepo_runtime/translations/messages.
|
123
|
-
oarepo_runtime/translations/cs/LC_MESSAGES/messages.
|
124
|
-
oarepo_runtime/translations/
|
125
|
-
oarepo_runtime/translations/en/LC_MESSAGES/messages.
|
126
|
-
oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=rZ2PGvkcJbmuwrWeFX5edk0zJIzZnL83M9HSAceDP_U,1193
|
121
|
+
oarepo_runtime/translations/messages.pot,sha256=jyC7mRH5P9uwVVqz9ycvn-T8gcohr62x__O0sC6g2w4,1846
|
122
|
+
oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=cSTRnVoi8DxfrXD-ImHYUmxdnNQMnxIn2yFRTObwRzI,801
|
123
|
+
oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=bzO7bZlnifHU0E7khXePmP12lGmzYXudjAWVDb87KrE,1508
|
124
|
+
oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=b4cLKr5VojJPSuCeQ9T1lJKYMM_o80IgiNNL-iQUL8E,445
|
125
|
+
oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=akMJzNcvoZmF9j06Cd_oyQX-tMOfYjG1yRAP7tNDhGA,1370
|
127
126
|
oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
128
127
|
oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
|
129
128
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
@@ -131,9 +130,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
131
130
|
tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
|
132
131
|
tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
|
133
132
|
tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
134
|
-
oarepo_runtime-1.5.
|
135
|
-
oarepo_runtime-1.5.
|
136
|
-
oarepo_runtime-1.5.
|
137
|
-
oarepo_runtime-1.5.
|
138
|
-
oarepo_runtime-1.5.
|
139
|
-
oarepo_runtime-1.5.
|
133
|
+
oarepo_runtime-1.5.74.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
134
|
+
oarepo_runtime-1.5.74.dist-info/METADATA,sha256=GHmgrkCfquYWIKwTRibqKKAOZUAD6FIfgOstHCJLFi0,4720
|
135
|
+
oarepo_runtime-1.5.74.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
|
136
|
+
oarepo_runtime-1.5.74.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
|
137
|
+
oarepo_runtime-1.5.74.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
|
138
|
+
oarepo_runtime-1.5.74.dist-info/RECORD,,
|
@@ -11,3 +11,6 @@ oarepo_runtime_info = oarepo_runtime.info.views:create_wellknown_blueprint
|
|
11
11
|
[invenio_celery.tasks]
|
12
12
|
oarepo_runtime_check = oarepo_runtime.tasks
|
13
13
|
oarepo_runtime_datastreams = oarepo_runtime.datastreams
|
14
|
+
|
15
|
+
[invenio_i18n.translations]
|
16
|
+
oarepo_runtime = oarepo_runtime
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|