oarepo-runtime 1.9.3__py3-none-any.whl → 1.9.4__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.
@@ -2,7 +2,8 @@ from functools import lru_cache
2
2
 
3
3
  import langcodes
4
4
  from invenio_base.utils import obj_or_import_string
5
- from marshmallow import Schema, ValidationError, fields, validates
5
+ from invenio_i18n import gettext as _
6
+ from marshmallow import Schema, ValidationError, fields, pre_load, validates
6
7
 
7
8
  """
8
9
  Marshmallow schema for multilingual strings. Consider moving this file to a library, not generating
@@ -14,18 +15,32 @@ it for each project.
14
15
  def get_i18n_schema(
15
16
  lang_name, value_name, value_field="marshmallow_utils.fields.SanitizedHTML"
16
17
  ):
17
- @validates(lang_name)
18
- def validate_lang(self, value):
19
- if value != "_" and not langcodes.Language.get(value).is_valid():
20
- raise ValidationError("Invalid language code")
18
+ class I18nMixin:
19
+ @validates(lang_name)
20
+ def validate_lang(self, value):
21
+ if value != "_" and not langcodes.Language.get(value).is_valid():
22
+ raise ValidationError("Invalid language code")
23
+
24
+ @pre_load
25
+ def pre_load_func(self, data, **kwargs):
26
+ errors = {}
27
+ if not data.get(lang_name) or not data.get(value_name):
28
+ errors[lang_name] = [_("Both language and text must be provided.")]
29
+ errors[value_name] = [_("Both language and text must be provided.")]
30
+
31
+ if errors:
32
+ raise ValidationError(errors)
33
+ return data
21
34
 
22
35
  value_field_class = obj_or_import_string(value_field)
23
36
 
24
37
  return type(
25
38
  f"I18nSchema_{lang_name}_{value_name}",
26
- (Schema,),
39
+ (
40
+ I18nMixin,
41
+ Schema,
42
+ ),
27
43
  {
28
- "validate_lang": validate_lang,
29
44
  lang_name: fields.String(required=True),
30
45
  value_name: value_field_class(required=True),
31
46
  },
@@ -67,3 +67,19 @@ msgstr "omezený přístup"
67
67
  #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
68
68
  msgid "access.status.metadata-only"
69
69
  msgstr "pouze metadata"
70
+
71
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:105
72
+ msgid "Recently updated"
73
+ msgstr ""
74
+
75
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:109
76
+ msgid "Least recently updated"
77
+ msgstr ""
78
+
79
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:121
80
+ msgid "Version"
81
+ msgstr ""
82
+
83
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:28
84
+ msgid "Both language and text must be provided."
85
+ msgstr "Musí být vyplněn jazyk i hodnota."
@@ -66,3 +66,24 @@ msgstr "restricted access"
66
66
  #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
67
67
  msgid "access.status.metadata-only"
68
68
  msgstr "metadata only access"
69
+
70
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:105
71
+ msgid "Recently updated"
72
+ msgstr ""
73
+
74
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:109
75
+ msgid "Least recently updated"
76
+ msgstr ""
77
+
78
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:121
79
+ msgid "Version"
80
+ msgstr ""
81
+
82
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:30
83
+ #, python-brace-format
84
+ msgid "Both '{lang_name}' and '{value_name}' fields must be provided."
85
+ msgstr ""
86
+
87
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:28
88
+ msgid "Both language and text must be provided."
89
+ msgstr ""
@@ -8,7 +8,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: 2025-02-17 10:27+0100\n"
11
+ "POT-Creation-Date: 2025-07-29 15:53+0200\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"
@@ -17,56 +17,75 @@ msgstr ""
17
17
  "Content-Transfer-Encoding: 8bit\n"
18
18
  "Generated-By: Babel 2.17.0\n"
19
19
 
20
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:71
21
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:175
20
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:80
21
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:224
22
22
  msgid "By Title"
23
23
  msgstr ""
24
24
 
25
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:75
26
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/translations/default_translations.py:5
25
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:84
26
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:101
27
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:5
27
28
  msgid "Best match"
28
29
  msgstr ""
29
30
 
30
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:79
31
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/translations/default_translations.py:3
31
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:88
32
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:113
33
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:3
32
34
  msgid "Newest"
33
35
  msgstr ""
34
36
 
35
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:83
36
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/translations/default_translations.py:4
37
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:92
38
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:117
39
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:4
37
40
  msgid "Oldest"
38
41
  msgstr ""
39
42
 
40
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:132
43
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:105
44
+ msgid "Recently updated"
45
+ msgstr ""
46
+
47
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:109
48
+ msgid "Least recently updated"
49
+ msgstr ""
50
+
51
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/search.py:121
52
+ msgid "Version"
53
+ msgstr ""
54
+
55
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/i18n.py:28
56
+ msgid "Both language and text must be provided."
57
+ msgstr ""
58
+
59
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
41
60
  msgid "True"
42
61
  msgstr ""
43
62
 
44
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:132
63
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
45
64
  msgid "False"
46
65
  msgstr ""
47
66
 
48
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:152
67
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:175
49
68
  msgid "access.status.open"
50
69
  msgstr ""
51
70
 
52
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:153
71
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:176
53
72
  msgid "access.status.embargoed"
54
73
  msgstr ""
55
74
 
56
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:154
75
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:177
57
76
  msgid "access.status.restricted"
58
77
  msgstr ""
59
78
 
60
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
79
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:178
61
80
  msgid "access.status.metadata-only"
62
81
  msgstr ""
63
82
 
64
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/validation.py:31
83
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/validation.py:35
65
84
  #, python-format
66
85
  msgid "Invalid value %(identifier)s of identifier type %(type)s"
67
86
  msgstr ""
68
87
 
69
- #: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/translations/default_translations.py:6
88
+ #: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/translations/default_translations.py:6
70
89
  msgid "Contact"
71
90
  msgstr ""
72
91
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oarepo-runtime
3
- Version: 1.9.3
3
+ Version: 1.9.4
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -129,7 +129,7 @@ oarepo_runtime/services/relations/errors.py,sha256=VtlOKq9MEUeJ4IsiZhY7lWoshrusA
129
129
  oarepo_runtime/services/relations/mapping.py,sha256=D7IYk83SXVgTv-0ohSnHOCzvCwbFLXJsayO1eQfQn0U,1285
130
130
  oarepo_runtime/services/schema/__init__.py,sha256=5u8wTvon4W6ODJNRJhRNChmQHAZTXwo6LV2mYRYs-EM,1377
131
131
  oarepo_runtime/services/schema/cf.py,sha256=-m9seIH5VYUdxDsJlPVXS0-8f7xkpN7YfW1q9E1GacI,475
132
- oarepo_runtime/services/schema/i18n.py,sha256=NACu0SqXWuuwKVpBZdz4K8tVfBaCEI9YpcCtC1l1YGI,1669
132
+ oarepo_runtime/services/schema/i18n.py,sha256=49hPDKSUubtwVRT1_k--ftMkmE0oD4_VGP2CJ1sEGnM,2186
133
133
  oarepo_runtime/services/schema/i18n_ui.py,sha256=MnEDW0gcZPvEODbJ6XzldxNCJ2suhfmdHQ4wkcAG6zA,2179
134
134
  oarepo_runtime/services/schema/i18n_validation.py,sha256=fyMTi2Rw-KiHv7c7HN61zGxRVa9sAjAEEkAL5wUyKNo,236
135
135
  oarepo_runtime/services/schema/marshmallow.py,sha256=iAMMH5MlYs59qetXAHOROvERNScfVqY9TrEIJejHCuw,1421
@@ -141,22 +141,22 @@ oarepo_runtime/services/schema/rdm_ui.py,sha256=ffjl20tvRcuX3FNINOhGJWX84aTNEzJO
141
141
  oarepo_runtime/services/schema/ui.py,sha256=ff2AfK-G0fArlVHHKsDagPhu9NkMj6DPcVK4NycEO8c,8216
142
142
  oarepo_runtime/services/schema/validation.py,sha256=aRfeR-2D1XXYqI3_U5FHoFvJrYjZlpM8nB35-M_u3Qs,2300
143
143
  oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
144
- oarepo_runtime/translations/messages.pot,sha256=wr1vDKjsngqS9e5zQmSAsF3qUAtpQ41SUXwzEKRCnWw,2406
145
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=mhVcQhLPW0QG_l4sYDiaiKc67oEVWVVYlwBxeQyDZdY,1044
146
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=WZwTlVNrA9Ifr4NFL2c9X9mshltvy6ovRcj29i3kgeM,2067
144
+ oarepo_runtime/translations/messages.pot,sha256=7Sf8l_70GjmKnXKYioUFp8Z65qtW57BgR9N9NlwmiNU,3013
145
+ oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=OxKvpWhjhv6WfhamLBrJ315vq7w1qVAhDoWRIk1qhAc,1138
146
+ oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=BtgVxnFb2xMl0j5vnSDHjQmTnDfuV5zEqcwJpHs9bTc,2568
147
147
  oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=tq5pTCpH7cuzdwrQlpTMjS1jlnoV0dWDlK9mGcKT338,673
148
- oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=7-5S3iINOSFSI5gVdRvT5S2rbGScrheJiUJQH_fqXmY,1914
148
+ oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=oWFA5kjT-sBNoZ3UIzYS03GQOvri5VqL9NcYnQnYsyQ,2562
149
149
  oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
150
  oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
151
151
  oarepo_runtime/utils/index.py,sha256=ArrUUXB-KowUcUksRKqcFpmqct4bn9alO1zd_kX2tmU,292
152
152
  oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
153
- oarepo_runtime-1.9.3.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
153
+ oarepo_runtime-1.9.4.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
154
154
  tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
155
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
156
156
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
157
157
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
158
- oarepo_runtime-1.9.3.dist-info/METADATA,sha256=TCd9T3D_rVijLNLyRH5HeSNcxdWs0h6qT38B0NMuf1Q,4788
159
- oarepo_runtime-1.9.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
160
- oarepo_runtime-1.9.3.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
161
- oarepo_runtime-1.9.3.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
162
- oarepo_runtime-1.9.3.dist-info/RECORD,,
158
+ oarepo_runtime-1.9.4.dist-info/METADATA,sha256=CVIJjZW7XgCVhHpzqhlMe-ljTHMwsXtm4Tl3u3a1554,4788
159
+ oarepo_runtime-1.9.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
160
+ oarepo_runtime-1.9.4.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
161
+ oarepo_runtime-1.9.4.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
162
+ oarepo_runtime-1.9.4.dist-info/RECORD,,