oarepo-runtime 1.5.93__py3-none-any.whl → 1.5.95__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/schema/ui.py +58 -0
- oarepo_runtime/services/search.py +31 -4
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo +0 -0
- oarepo_runtime/translations/cs/LC_MESSAGES/messages.po +16 -0
- oarepo_runtime/translations/en/LC_MESSAGES/messages.mo +0 -0
- oarepo_runtime/translations/en/LC_MESSAGES/messages.po +16 -0
- oarepo_runtime/translations/messages.pot +32 -16
- {oarepo_runtime-1.5.93.dist-info → oarepo_runtime-1.5.95.dist-info}/METADATA +1 -1
- {oarepo_runtime-1.5.93.dist-info → oarepo_runtime-1.5.95.dist-info}/RECORD +13 -13
- {oarepo_runtime-1.5.93.dist-info → oarepo_runtime-1.5.95.dist-info}/LICENSE +0 -0
- {oarepo_runtime-1.5.93.dist-info → oarepo_runtime-1.5.95.dist-info}/WHEEL +0 -0
- {oarepo_runtime-1.5.93.dist-info → oarepo_runtime-1.5.95.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-1.5.93.dist-info → oarepo_runtime-1.5.95.dist-info}/top_level.txt +0 -0
@@ -5,6 +5,12 @@ import marshmallow as ma
|
|
5
5
|
from babel.dates import format_date
|
6
6
|
from babel_edtf import format_edtf
|
7
7
|
from flask import current_app
|
8
|
+
from invenio_rdm_records.records.systemfields.access.field.record import (
|
9
|
+
AccessStatusEnum,
|
10
|
+
)
|
11
|
+
from invenio_rdm_records.resources.serializers.ui.fields import (
|
12
|
+
UIObjectAccessStatus as InvenioUIObjectAccessStatus,
|
13
|
+
)
|
8
14
|
from marshmallow_utils.fields import (
|
9
15
|
BabelGettextDictField,
|
10
16
|
FormatDate,
|
@@ -15,6 +21,9 @@ from marshmallow_utils.fields import (
|
|
15
21
|
from marshmallow_utils.fields.babel import BabelFormatField
|
16
22
|
|
17
23
|
from oarepo_runtime.i18n import gettext
|
24
|
+
from oarepo_runtime.i18n import lazy_gettext as _
|
25
|
+
|
26
|
+
from .marshmallow import RDMBaseRecordSchema
|
18
27
|
|
19
28
|
|
20
29
|
def current_default_locale():
|
@@ -131,3 +140,52 @@ class InvenioUISchema(ma.Schema):
|
|
131
140
|
links = ma.fields.Raw(dump_only=True)
|
132
141
|
revision_id = ma.fields.Integer(dump_only=True)
|
133
142
|
expanded = ma.fields.Raw(dump_only=True)
|
143
|
+
|
144
|
+
|
145
|
+
# seems not possible to avoid, as they have this hardcoded in their object,
|
146
|
+
# and translation keys are i.e. open, which gets translated to otevret
|
147
|
+
class UIObjectAccessStatus(InvenioUIObjectAccessStatus):
|
148
|
+
@property
|
149
|
+
def title(self):
|
150
|
+
"""Access status title."""
|
151
|
+
return {
|
152
|
+
AccessStatusEnum.OPEN: _("access.status.open"),
|
153
|
+
AccessStatusEnum.EMBARGOED: _("access.status.embargoed"),
|
154
|
+
AccessStatusEnum.RESTRICTED: _("access.status.restricted"),
|
155
|
+
AccessStatusEnum.METADATA_ONLY: _("access.status.metadata-only"),
|
156
|
+
}.get(self.access_status)
|
157
|
+
|
158
|
+
|
159
|
+
class AccessStatusField(ma.fields.Field):
|
160
|
+
"""Record access status."""
|
161
|
+
|
162
|
+
def _serialize(self, value, attr, obj, **kwargs):
|
163
|
+
"""Serialise access status."""
|
164
|
+
record_access_dict = obj.get("access")
|
165
|
+
_files = obj.get("files", {})
|
166
|
+
has_files = _files is not None and _files.get("enabled", False)
|
167
|
+
if record_access_dict:
|
168
|
+
record_access_status_ui = UIObjectAccessStatus(
|
169
|
+
record_access_dict, has_files
|
170
|
+
)
|
171
|
+
return {
|
172
|
+
"id": record_access_status_ui.id,
|
173
|
+
"title_l10n": record_access_status_ui.title,
|
174
|
+
"description_l10n": record_access_status_ui.description,
|
175
|
+
"icon": record_access_status_ui.icon,
|
176
|
+
"embargo_date_l10n": record_access_status_ui.embargo_date,
|
177
|
+
"message_class": record_access_status_ui.message_class,
|
178
|
+
}
|
179
|
+
|
180
|
+
|
181
|
+
class InvenioRDMUISchema(InvenioUISchema, RDMBaseRecordSchema):
|
182
|
+
is_draft = ma.fields.Boolean(dump_only=True)
|
183
|
+
access_status = AccessStatusField(attribute="access", dump_only=True)
|
184
|
+
|
185
|
+
def hide_tombstone(self, data):
|
186
|
+
"""Hide tombstone info if the record isn't deleted and metadata if it is."""
|
187
|
+
return data
|
188
|
+
|
189
|
+
def default_nested(self, data):
|
190
|
+
"""Serialize fields as empty dict for partial drafts."""
|
191
|
+
return data
|
@@ -5,9 +5,7 @@ from typing import List
|
|
5
5
|
from invenio_rdm_records.services.config import (
|
6
6
|
RDMSearchDraftsOptions as BaseRDMSearchDraftsOptions,
|
7
7
|
)
|
8
|
-
from invenio_rdm_records.services.config import
|
9
|
-
RDMSearchOptions as BaseRDMSearchOptions,
|
10
|
-
)
|
8
|
+
from invenio_rdm_records.services.config import RDMSearchOptions as BaseRDMSearchOptions
|
11
9
|
from invenio_records_resources.proxies import current_service_registry
|
12
10
|
from invenio_records_resources.services.records import (
|
13
11
|
SearchOptions as InvenioSearchOptions,
|
@@ -86,6 +84,35 @@ class SearchOptionsMixin:
|
|
86
84
|
}
|
87
85
|
|
88
86
|
|
87
|
+
class SearchOptionsDraftMixin(SearchOptionsMixin):
|
88
|
+
sort_options = {
|
89
|
+
"bestmatch": dict(
|
90
|
+
title=_("Best match"),
|
91
|
+
fields=["_score"], # search defaults to desc on `_score` field
|
92
|
+
),
|
93
|
+
"updated-desc": dict(
|
94
|
+
title=_("Recently updated"),
|
95
|
+
fields=["-updated"],
|
96
|
+
),
|
97
|
+
"updated-asc": dict(
|
98
|
+
title=_("Least recently updated"),
|
99
|
+
fields=["updated"],
|
100
|
+
),
|
101
|
+
"newest": dict(
|
102
|
+
title=_("Newest"),
|
103
|
+
fields=["-created"],
|
104
|
+
),
|
105
|
+
"oldest": dict(
|
106
|
+
title=_("Oldest"),
|
107
|
+
fields=["created"],
|
108
|
+
),
|
109
|
+
"version": dict(
|
110
|
+
title=_("Version"),
|
111
|
+
fields=["-versions.index"],
|
112
|
+
),
|
113
|
+
}
|
114
|
+
|
115
|
+
|
89
116
|
class SearchOptions(SearchOptionsMixin, InvenioSearchOptions):
|
90
117
|
# TODO: should be changed
|
91
118
|
params_interpreters_cls = [
|
@@ -100,7 +127,7 @@ class RDMSearchOptions(SearchOptionsMixin, BaseRDMSearchOptions):
|
|
100
127
|
pass
|
101
128
|
|
102
129
|
|
103
|
-
class RDMSearchDraftsOptions(
|
130
|
+
class RDMSearchDraftsOptions(SearchOptionsDraftMixin, BaseRDMSearchDraftsOptions):
|
104
131
|
pass
|
105
132
|
|
106
133
|
|
Binary file
|
@@ -51,3 +51,19 @@ msgstr "Ne"
|
|
51
51
|
#, python-format
|
52
52
|
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
53
53
|
msgstr "%(type)s: Neplatná hodnota '%(identifier)s'"
|
54
|
+
|
55
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:152
|
56
|
+
msgid "access.status.open"
|
57
|
+
msgstr "otevřený přístup"
|
58
|
+
|
59
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:153
|
60
|
+
msgid "access.status.embargoed"
|
61
|
+
msgstr "odložené zpřístupnění"
|
62
|
+
|
63
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:154
|
64
|
+
msgid "access.status.restricted"
|
65
|
+
msgstr "omezený přístup"
|
66
|
+
|
67
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
68
|
+
msgid "access.status.metadata-only"
|
69
|
+
msgstr "pouze metadata"
|
Binary file
|
@@ -50,3 +50,19 @@ msgstr ""
|
|
50
50
|
#, python-format
|
51
51
|
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
52
52
|
msgstr ""
|
53
|
+
|
54
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:152
|
55
|
+
msgid "access.status.open"
|
56
|
+
msgstr "open access"
|
57
|
+
|
58
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:153
|
59
|
+
msgid "access.status.embargoed"
|
60
|
+
msgstr "embargoed access"
|
61
|
+
|
62
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:154
|
63
|
+
msgid "access.status.restricted"
|
64
|
+
msgstr "restricted access"
|
65
|
+
|
66
|
+
#: /Users/m/w/cesnet/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
67
|
+
msgid "access.status.metadata-only"
|
68
|
+
msgstr "metadata only access"
|
@@ -1,56 +1,72 @@
|
|
1
1
|
# Translations template for PROJECT.
|
2
|
-
# Copyright (C)
|
2
|
+
# Copyright (C) 2025 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>, 2025.
|
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: 2025-02-17 10:27+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.17.0\n"
|
19
19
|
|
20
|
-
#: /
|
21
|
-
#: /
|
20
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:71
|
21
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/search.py:175
|
22
22
|
msgid "By Title"
|
23
23
|
msgstr ""
|
24
24
|
|
25
|
-
#: /
|
26
|
-
#: /
|
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
|
27
27
|
msgid "Best match"
|
28
28
|
msgstr ""
|
29
29
|
|
30
|
-
#: /
|
31
|
-
#: /
|
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
|
32
32
|
msgid "Newest"
|
33
33
|
msgstr ""
|
34
34
|
|
35
|
-
#: /
|
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
37
|
msgid "Oldest"
|
38
38
|
msgstr ""
|
39
39
|
|
40
|
-
#: /
|
40
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:132
|
41
41
|
msgid "True"
|
42
42
|
msgstr ""
|
43
43
|
|
44
|
-
#: /
|
44
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:132
|
45
45
|
msgid "False"
|
46
46
|
msgstr ""
|
47
47
|
|
48
|
-
#: /
|
48
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:152
|
49
|
+
msgid "access.status.open"
|
50
|
+
msgstr ""
|
51
|
+
|
52
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:153
|
53
|
+
msgid "access.status.embargoed"
|
54
|
+
msgstr ""
|
55
|
+
|
56
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:154
|
57
|
+
msgid "access.status.restricted"
|
58
|
+
msgstr ""
|
59
|
+
|
60
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/ui.py:155
|
61
|
+
msgid "access.status.metadata-only"
|
62
|
+
msgstr ""
|
63
|
+
|
64
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/services/schema/validation.py:31
|
49
65
|
#, python-format
|
50
66
|
msgid "Invalid value %(identifier)s of identifier type %(type)s"
|
51
67
|
msgstr ""
|
52
68
|
|
53
|
-
#: /
|
69
|
+
#: /home/dusanst/Projects/oarepo-runtime/oarepo_runtime/translations/default_translations.py:6
|
54
70
|
msgid "Contact"
|
55
71
|
msgstr ""
|
56
72
|
|
@@ -76,7 +76,7 @@ oarepo_runtime/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
76
76
|
oarepo_runtime/services/components.py,sha256=h7oQNPueuPqBD6mCRCIr7ZuNvzeliXinHjOyVV3FBvw,10775
|
77
77
|
oarepo_runtime/services/generators.py,sha256=j87HitHA_w2awsz0C5IAAJ0qjg9JMtvdO3dvh6FQyfg,250
|
78
78
|
oarepo_runtime/services/results.py,sha256=Ap2mUJHl3V4BSduTrBWPuco0inQVq0QsuCbVhez48uY,5705
|
79
|
-
oarepo_runtime/services/search.py,sha256=
|
79
|
+
oarepo_runtime/services/search.py,sha256=mUycojDo26p54ZZPqXcXmdhUrzAP_eKCWls2XYJSM6c,8186
|
80
80
|
oarepo_runtime/services/config/__init__.py,sha256=559w4vphVAipa420OwTsxGUP-b7idoqSIX13FSJyVz0,783
|
81
81
|
oarepo_runtime/services/config/link_conditions.py,sha256=evPRd5XU76Ok4J-08bBfplbHZ019rl74FpJmO8iM5yg,3298
|
82
82
|
oarepo_runtime/services/config/permissions_presets.py,sha256=YF99Vjh1fGqSEXNw7qIfcUQFvzpE54_BafqkO6wlYHk,6668
|
@@ -120,14 +120,14 @@ oarepo_runtime/services/schema/marshmallow_to_json_schema.py,sha256=VYLnVWHOoaxW
|
|
120
120
|
oarepo_runtime/services/schema/oneofschema.py,sha256=GnWH4Or_G5M0NgSmCoqMI6PBrJg5AC9RHrcB5QDKRq0,6661
|
121
121
|
oarepo_runtime/services/schema/polymorphic.py,sha256=bAbUoTIeDBiJPYPhpLEKKZekEdkHlpqkmNxk1hN3PDw,564
|
122
122
|
oarepo_runtime/services/schema/rdm.py,sha256=4gi44LIMWS9kWcZfEoHaJSq585qfZfMuUYM5IvL1nQo,531
|
123
|
-
oarepo_runtime/services/schema/ui.py,sha256=
|
123
|
+
oarepo_runtime/services/schema/ui.py,sha256=qS9ZnKlo1xib8VJe3uFEff8mCQF5qtjoyOqfa0xOT70,6055
|
124
124
|
oarepo_runtime/services/schema/validation.py,sha256=VFOKSxQLHwFb7bW8BJAFXWe_iTAZFOfqOnb2Ko_Yxxc,2085
|
125
125
|
oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
|
126
|
-
oarepo_runtime/translations/messages.pot,sha256=
|
127
|
-
oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=
|
128
|
-
oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=
|
129
|
-
oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=
|
130
|
-
oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=
|
126
|
+
oarepo_runtime/translations/messages.pot,sha256=wr1vDKjsngqS9e5zQmSAsF3qUAtpQ41SUXwzEKRCnWw,2406
|
127
|
+
oarepo_runtime/translations/cs/LC_MESSAGES/messages.mo,sha256=mhVcQhLPW0QG_l4sYDiaiKc67oEVWVVYlwBxeQyDZdY,1044
|
128
|
+
oarepo_runtime/translations/cs/LC_MESSAGES/messages.po,sha256=WZwTlVNrA9Ifr4NFL2c9X9mshltvy6ovRcj29i3kgeM,2067
|
129
|
+
oarepo_runtime/translations/en/LC_MESSAGES/messages.mo,sha256=tq5pTCpH7cuzdwrQlpTMjS1jlnoV0dWDlK9mGcKT338,673
|
130
|
+
oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=7-5S3iINOSFSI5gVdRvT5S2rbGScrheJiUJQH_fqXmY,1914
|
131
131
|
oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
132
132
|
oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
|
133
133
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
@@ -135,9 +135,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
135
135
|
tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
|
136
136
|
tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
|
137
137
|
tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
138
|
-
oarepo_runtime-1.5.
|
139
|
-
oarepo_runtime-1.5.
|
140
|
-
oarepo_runtime-1.5.
|
141
|
-
oarepo_runtime-1.5.
|
142
|
-
oarepo_runtime-1.5.
|
143
|
-
oarepo_runtime-1.5.
|
138
|
+
oarepo_runtime-1.5.95.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
139
|
+
oarepo_runtime-1.5.95.dist-info/METADATA,sha256=vWqmdskxhbS-TLvIf-ZgenwVMTWx3nZgu5XThZVFqdo,4720
|
140
|
+
oarepo_runtime-1.5.95.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
141
|
+
oarepo_runtime-1.5.95.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
|
142
|
+
oarepo_runtime-1.5.95.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
|
143
|
+
oarepo_runtime-1.5.95.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|