oarepo-runtime 1.3.20__py3-none-any.whl → 1.3.21__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/drafts/__init__.py +0 -0
- oarepo_runtime/drafts/systemfields/__init__.py +0 -0
- oarepo_runtime/drafts/systemfields/has_draftcheck.py +47 -0
- oarepo_runtime/ext.py +3 -0
- oarepo_runtime/ext_config.py +3 -0
- {oarepo_runtime-1.3.20.dist-info → oarepo_runtime-1.3.21.dist-info}/METADATA +3 -1
- {oarepo_runtime-1.3.20.dist-info → oarepo_runtime-1.3.21.dist-info}/RECORD +11 -8
- {oarepo_runtime-1.3.20.dist-info → oarepo_runtime-1.3.21.dist-info}/LICENSE +0 -0
- {oarepo_runtime-1.3.20.dist-info → oarepo_runtime-1.3.21.dist-info}/WHEEL +0 -0
- {oarepo_runtime-1.3.20.dist-info → oarepo_runtime-1.3.21.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-1.3.20.dist-info → oarepo_runtime-1.3.21.dist-info}/top_level.txt +0 -0
File without changes
|
File without changes
|
@@ -0,0 +1,47 @@
|
|
1
|
+
from invenio_records.dictutils import dict_set
|
2
|
+
from invenio_records.systemfields import SystemField
|
3
|
+
from sqlalchemy.orm.exc import NoResultFound
|
4
|
+
|
5
|
+
from oarepo_runtime.cf import CustomFieldsMixin
|
6
|
+
|
7
|
+
|
8
|
+
# taken from https://github.com/inveniosoftware/invenio-rdm-records/blob/master/invenio_rdm_records/records/systemfields/has_draftcheck.py
|
9
|
+
class HasDraftCheckField(CustomFieldsMixin, SystemField):
|
10
|
+
"""PID status field which checks against an expected status."""
|
11
|
+
|
12
|
+
def __init__(self, draft_cls=None, key=None, **kwargs):
|
13
|
+
"""Initialize the PIDField.
|
14
|
+
|
15
|
+
It stores the `record.has_draft` value in the secondary storage
|
16
|
+
system's record or defaults to `False` if the `draft_cls` is not passed
|
17
|
+
e.g Draft records.
|
18
|
+
|
19
|
+
:param key: Attribute name of the HasDraftCheckField.
|
20
|
+
:param draft_cls: The draft class to use for querying.
|
21
|
+
"""
|
22
|
+
super().__init__(key=key, **kwargs)
|
23
|
+
self.draft_cls = draft_cls
|
24
|
+
|
25
|
+
#
|
26
|
+
# Data descriptor methods (i.e. attribute access)
|
27
|
+
#
|
28
|
+
def __get__(self, record, owner=None):
|
29
|
+
if record is None:
|
30
|
+
return self # returns the field itself.
|
31
|
+
|
32
|
+
# If not draft_cls is passed return False
|
33
|
+
if self.draft_cls is None:
|
34
|
+
return False
|
35
|
+
|
36
|
+
try:
|
37
|
+
self.draft_cls.get_record(record.id)
|
38
|
+
return True
|
39
|
+
except NoResultFound:
|
40
|
+
return False
|
41
|
+
|
42
|
+
def pre_dump(self, record, data, **kwargs):
|
43
|
+
dict_set(data, self.key, record.has_draft)
|
44
|
+
"""
|
45
|
+
def post_load(self, record, data, **kwargs):
|
46
|
+
record.pop(self.key, None)
|
47
|
+
"""
|
oarepo_runtime/ext.py
CHANGED
oarepo_runtime/ext_config.py
CHANGED
@@ -11,6 +11,7 @@ from oarepo_runtime.datastreams.readers.service import ServiceReader
|
|
11
11
|
from oarepo_runtime.datastreams.readers.yaml import YamlReader
|
12
12
|
from oarepo_runtime.datastreams.writers.service import ServiceWriter
|
13
13
|
from oarepo_runtime.datastreams.writers.yaml import YamlWriter
|
14
|
+
from invenio_records_resources.services.custom_fields import BooleanCF
|
14
15
|
|
15
16
|
OAREPO_PERMISSIONS_PRESETS = {
|
16
17
|
"read_only": ReadOnlyPermissionPolicy,
|
@@ -53,3 +54,5 @@ DATASTREAMS_TRANSFORMERS = {}
|
|
53
54
|
DEFAULT_DATASTREAMS_EXCLUDES = []
|
54
55
|
|
55
56
|
DATASTREAMS_CONFIG_GENERATOR = default_config_generator
|
57
|
+
|
58
|
+
HAS_DRAFT_CUSTOM_FIELD = [BooleanCF("has_draft")]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: oarepo-runtime
|
3
|
-
Version: 1.3.
|
3
|
+
Version: 1.3.21
|
4
4
|
Summary: A set of runtime extensions of Invenio repository
|
5
5
|
Description-Content-Type: text/markdown
|
6
6
|
License-File: LICENSE
|
@@ -25,6 +25,8 @@ Requires-Dist: invenio-app ; extra == 'tests'
|
|
25
25
|
Requires-Dist: invenio-search[opensearch2] ; extra == 'tests'
|
26
26
|
Requires-Dist: oarepo (<12,>=11.0) ; extra == 'tests'
|
27
27
|
Requires-Dist: uritemplate (>=4.1.1) ; extra == 'tests'
|
28
|
+
Requires-Dist: oarepo-model-builder ; extra == 'tests'
|
29
|
+
Requires-Dist: oarepo-model-builder-tests ; extra == 'tests'
|
28
30
|
|
29
31
|
# OARepo runtime
|
30
32
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
oarepo_runtime/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
oarepo_runtime/ext.py,sha256=
|
3
|
-
oarepo_runtime/ext_config.py,sha256=
|
2
|
+
oarepo_runtime/ext.py,sha256=D6-vAzXawQ9tvUuuPeNevBJ_6FGtkJynQveBdGYIYXY,1569
|
3
|
+
oarepo_runtime/ext_config.py,sha256=_sun7XB6ylxtyoPcJImJLwUGUYgkWuevVClxYPofj1c,1696
|
4
4
|
oarepo_runtime/marshmallow.py,sha256=BaRh9Z07h2DznYMyYxiTmSfe4EJaeXvTY8lKVyvVGa4,340
|
5
5
|
oarepo_runtime/polymorphic.py,sha256=CkvXVUiXbrsLWFgoNnjjpUviQyzRMCmpsD3GWfV0WZA,494
|
6
6
|
oarepo_runtime/cf/__init__.py,sha256=z6PcNsz2Xtp6ozDeZ25plYjmjKaKHXoovd_uzjKzRFs,1322
|
@@ -33,6 +33,9 @@ oarepo_runtime/datastreams/writers/__init__.py,sha256=8HIRwHxacUxvluqKxog8pUE1iK
|
|
33
33
|
oarepo_runtime/datastreams/writers/service.py,sha256=ALXGibX1QTpSH720GQL2Axm8RTmnSDiYYkPmwBmEMzE,3414
|
34
34
|
oarepo_runtime/datastreams/writers/validation_errors.py,sha256=wOCXdniR6so_4ExpdFYYgBRyENp7_6kVFZM2L-Hy3G8,661
|
35
35
|
oarepo_runtime/datastreams/writers/yaml.py,sha256=B4lv-85UYB9K-3B35O1_vsRhH8AdhYfL8IgB3SS1LFw,1312
|
36
|
+
oarepo_runtime/drafts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
|
+
oarepo_runtime/drafts/systemfields/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
|
+
oarepo_runtime/drafts/systemfields/has_draftcheck.py,sha256=Vs7PtjRtVTBmaMB92-Buwfg67ecyV6y8_WsNDCutkjg,1597
|
36
39
|
oarepo_runtime/expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
40
|
oarepo_runtime/expansions/expandable_fields.py,sha256=7DWKFL6ml8J7zGI6wm9LO7Xd6R0LSylsuq4lyRumNHQ,745
|
38
41
|
oarepo_runtime/expansions/service.py,sha256=HaEy76XOhDf__sQ91hi-8iH1hthM9q07pRhOmyZyVrs,144
|
@@ -71,9 +74,9 @@ oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
|
|
71
74
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
72
75
|
oarepo_runtime/validation/__init__.py,sha256=lU7DgZq8pGD5Pa-QqL9gvLsib3IYtM-Y56k-NwHrPG0,166
|
73
76
|
oarepo_runtime/validation/dates.py,sha256=fahqKGDdIYWux5ZeoljrEe8VD2fDZR9VpfvYmTYAmpw,1050
|
74
|
-
oarepo_runtime-1.3.
|
75
|
-
oarepo_runtime-1.3.
|
76
|
-
oarepo_runtime-1.3.
|
77
|
-
oarepo_runtime-1.3.
|
78
|
-
oarepo_runtime-1.3.
|
79
|
-
oarepo_runtime-1.3.
|
77
|
+
oarepo_runtime-1.3.21.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
78
|
+
oarepo_runtime-1.3.21.dist-info/METADATA,sha256=prtM79Yq-KyJOPXgthDXlrTSgO1PAB37hJ3s7EKrAEk,2668
|
79
|
+
oarepo_runtime-1.3.21.dist-info/WHEEL,sha256=AtBG6SXL3KF_v0NxLf0ehyVOh0cold-JbJYXNGorC6Q,92
|
80
|
+
oarepo_runtime-1.3.21.dist-info/entry_points.txt,sha256=C32W4eT-8OypMCfwOO5WREioVKSneDfY51D78Uvdbp0,231
|
81
|
+
oarepo_runtime-1.3.21.dist-info/top_level.txt,sha256=Vdo5ohKvEHniyXfcy3hv92nVSYIngDYGQtinWviujlw,15
|
82
|
+
oarepo_runtime-1.3.21.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|