oarepo-runtime 2.0.0.dev4__py3-none-any.whl → 2.0.0.dev5__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/__init__.py +1 -1
- oarepo_runtime/api.py +20 -1
- oarepo_runtime/config.py +13 -6
- {oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/METADATA +1 -1
- {oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/RECORD +8 -8
- {oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/WHEEL +0 -0
- {oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/licenses/LICENSE +0 -0
oarepo_runtime/__init__.py
CHANGED
oarepo_runtime/api.py
CHANGED
@@ -13,9 +13,10 @@ from __future__ import annotations
|
|
13
13
|
|
14
14
|
import dataclasses
|
15
15
|
from functools import cached_property
|
16
|
-
from typing import TYPE_CHECKING, cast
|
16
|
+
from typing import TYPE_CHECKING, Any, cast
|
17
17
|
|
18
18
|
from flask import current_app
|
19
|
+
from invenio_base import invenio_url_for
|
19
20
|
from invenio_base.utils import obj_or_import_string
|
20
21
|
from invenio_records_resources.proxies import current_service_registry
|
21
22
|
|
@@ -37,6 +38,9 @@ class Export:
|
|
37
38
|
Exports are shown on the record landing page and user can download them.
|
38
39
|
"""
|
39
40
|
|
41
|
+
code: str
|
42
|
+
"""Code of the export format, used to identify the export format in the URL."""
|
43
|
+
|
40
44
|
name: LazyString
|
41
45
|
"""Name of the export format, human readable."""
|
42
46
|
|
@@ -75,6 +79,9 @@ class Model[
|
|
75
79
|
variable.
|
76
80
|
"""
|
77
81
|
|
82
|
+
code: str
|
83
|
+
"""Code of the model, used to identify the model"""
|
84
|
+
|
78
85
|
name: str | LazyString
|
79
86
|
"""Name of the model, human readable."""
|
80
87
|
|
@@ -90,6 +97,8 @@ class Model[
|
|
90
97
|
|
91
98
|
def __init__( # noqa: PLR0913 more attributes as we are creating a config
|
92
99
|
self,
|
100
|
+
*,
|
101
|
+
code: str,
|
93
102
|
name: str | LazyString,
|
94
103
|
version: str,
|
95
104
|
service: str | S,
|
@@ -125,6 +134,7 @@ class Model[
|
|
125
134
|
:param records_alias_enabled: Whether the records alias is enabled for this model.
|
126
135
|
Such models will be searchable via the `/api/records` endpoint.
|
127
136
|
"""
|
137
|
+
self.code = code
|
128
138
|
self.name = name
|
129
139
|
self.version = version
|
130
140
|
self.description = description
|
@@ -172,6 +182,15 @@ class Model[
|
|
172
182
|
return None
|
173
183
|
return self._draft
|
174
184
|
|
185
|
+
@property
|
186
|
+
def api_blueprint_name(self) -> str:
|
187
|
+
"""Get the API blueprint name for the model."""
|
188
|
+
return cast("str", self.resource_config.blueprint_name)
|
189
|
+
|
190
|
+
def api_url(self, view_name: str, **kwargs: Any) -> str:
|
191
|
+
"""Get the API URL for the model."""
|
192
|
+
return cast("str", invenio_url_for(f"{self.api_blueprint_name}.{view_name}", **kwargs))
|
193
|
+
|
175
194
|
@cached_property
|
176
195
|
def resource_config(self) -> RC:
|
177
196
|
"""Get the resource configuration."""
|
oarepo_runtime/config.py
CHANGED
@@ -13,6 +13,7 @@ from __future__ import annotations
|
|
13
13
|
|
14
14
|
from typing import TYPE_CHECKING, Any
|
15
15
|
|
16
|
+
from invenio_i18n import lazy_gettext as _
|
16
17
|
from invenio_vocabularies import __version__ as vocabularies_version
|
17
18
|
|
18
19
|
from .api import Model
|
@@ -43,7 +44,8 @@ def build_config[T](config_class: type[T], app: Flask, *args: Any, **kwargs: Any
|
|
43
44
|
OAREPO_MODELS: dict[str, Model] = {
|
44
45
|
# default invenio vocabularies
|
45
46
|
"vocabularies": Model(
|
46
|
-
|
47
|
+
code="vocabularies",
|
48
|
+
name=_("Base vocabularies"),
|
47
49
|
version=vocabularies_version,
|
48
50
|
service="vocabularies",
|
49
51
|
description="Base (non-specialized) invenio vocabularies",
|
@@ -53,7 +55,8 @@ OAREPO_MODELS: dict[str, Model] = {
|
|
53
55
|
),
|
54
56
|
# affiliations
|
55
57
|
"affiliations": Model(
|
56
|
-
|
58
|
+
code="affiliations",
|
59
|
+
name=_("Affiliations"),
|
57
60
|
version=vocabularies_version,
|
58
61
|
service="affiliations",
|
59
62
|
description="Affiliations vocabulary",
|
@@ -63,7 +66,8 @@ OAREPO_MODELS: dict[str, Model] = {
|
|
63
66
|
),
|
64
67
|
# funders
|
65
68
|
"funders": Model(
|
66
|
-
|
69
|
+
code="funders",
|
70
|
+
name=_("Funders"),
|
67
71
|
version=vocabularies_version,
|
68
72
|
service="funders",
|
69
73
|
description="Funders vocabulary",
|
@@ -73,7 +77,8 @@ OAREPO_MODELS: dict[str, Model] = {
|
|
73
77
|
),
|
74
78
|
# awards
|
75
79
|
"awards": Model(
|
76
|
-
|
80
|
+
code="awards",
|
81
|
+
name=_("Awards"),
|
77
82
|
version=vocabularies_version,
|
78
83
|
service="awards",
|
79
84
|
description="Awards vocabulary",
|
@@ -83,7 +88,8 @@ OAREPO_MODELS: dict[str, Model] = {
|
|
83
88
|
),
|
84
89
|
# names
|
85
90
|
"names": Model(
|
86
|
-
|
91
|
+
code="names",
|
92
|
+
name=_("Names"),
|
87
93
|
version=vocabularies_version,
|
88
94
|
service="names",
|
89
95
|
description="Names vocabulary",
|
@@ -93,7 +99,8 @@ OAREPO_MODELS: dict[str, Model] = {
|
|
93
99
|
),
|
94
100
|
# subjects
|
95
101
|
"subjects": Model(
|
96
|
-
|
102
|
+
code="subjects",
|
103
|
+
name=_("Subjects"),
|
97
104
|
version=vocabularies_version,
|
98
105
|
service="subjects",
|
99
106
|
description="Subjects vocabulary",
|
@@ -1,6 +1,6 @@
|
|
1
|
-
oarepo_runtime/__init__.py,sha256=
|
2
|
-
oarepo_runtime/api.py,sha256=
|
3
|
-
oarepo_runtime/config.py,sha256=
|
1
|
+
oarepo_runtime/__init__.py,sha256=1nCgSbvNvQVT0Ynpy_ygn15FJOE0XbYHkK2sAzt5bWA,685
|
2
|
+
oarepo_runtime/api.py,sha256=yRgU_LKuH3dRvK-M4phly3h9DzNYItaFtgbjqjeMEdA,8627
|
3
|
+
oarepo_runtime/config.py,sha256=RUEPFn_5bKp9Wb0OY-Fb3VK30m35vF5IsLjYaQHhP3g,3838
|
4
4
|
oarepo_runtime/ext.py,sha256=AMb5pMnCSbqIpPyP99YUKlf9vopz_b2ZW-RnvfsEVlk,3254
|
5
5
|
oarepo_runtime/proxies.py,sha256=PXaRiBh5qs5-h8M81cJOgtqypFQcYUSjiSn2TLSujRw,648
|
6
6
|
oarepo_runtime/cli/__init__.py,sha256=iPs1a4blP7750rwEXobzK3YHgsfGxoVTZxwWMslAlTY,350
|
@@ -25,8 +25,8 @@ oarepo_runtime/services/records/mapping.py,sha256=y3oeToKEnaRYpMV3q2-2cXNzyzyL3X
|
|
25
25
|
oarepo_runtime/services/schema/__init__.py,sha256=jgAPI_uKC6Ug4KQWnwQVg3-aNaw-eHja323AUFo5ELo,351
|
26
26
|
oarepo_runtime/services/schema/i18n.py,sha256=9D1zOQaPKAnYzejB0vO-m2BJYnam0N0Lrq4jID7twfE,3174
|
27
27
|
oarepo_runtime/services/schema/i18n_ui.py,sha256=DbusphhGDeaobTt4nuwNgKZ6Houlu4Sv3SuMGkdjRRY,3582
|
28
|
-
oarepo_runtime-2.0.0.
|
29
|
-
oarepo_runtime-2.0.0.
|
30
|
-
oarepo_runtime-2.0.0.
|
31
|
-
oarepo_runtime-2.0.0.
|
32
|
-
oarepo_runtime-2.0.0.
|
28
|
+
oarepo_runtime-2.0.0.dev5.dist-info/METADATA,sha256=w-FR66FJ2qaM2QLi3u5U5d4icH5AiJoxVULomc4a97U,4494
|
29
|
+
oarepo_runtime-2.0.0.dev5.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
30
|
+
oarepo_runtime-2.0.0.dev5.dist-info/entry_points.txt,sha256=7HqK5jumIgDVJa7ifjPKizginfIm5_R_qUVKPf_Yq-c,145
|
31
|
+
oarepo_runtime-2.0.0.dev5.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
32
|
+
oarepo_runtime-2.0.0.dev5.dist-info/RECORD,,
|
File without changes
|
{oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/entry_points.txt
RENAMED
File without changes
|
{oarepo_runtime-2.0.0.dev4.dist-info → oarepo_runtime-2.0.0.dev5.dist-info}/licenses/LICENSE
RENAMED
File without changes
|