oarepo-runtime 1.5.133__py3-none-any.whl → 1.5.135__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/facets/__init__.py +2 -1
- oarepo_runtime/services/facets/multilingual_facet.py +33 -0
- oarepo_runtime/services/schema/rdm.py +34 -7
- {oarepo_runtime-1.5.133.dist-info → oarepo_runtime-1.5.135.dist-info}/METADATA +1 -1
- {oarepo_runtime-1.5.133.dist-info → oarepo_runtime-1.5.135.dist-info}/RECORD +9 -8
- {oarepo_runtime-1.5.133.dist-info → oarepo_runtime-1.5.135.dist-info}/WHEEL +1 -1
- {oarepo_runtime-1.5.133.dist-info → oarepo_runtime-1.5.135.dist-info}/entry_points.txt +0 -0
- {oarepo_runtime-1.5.133.dist-info → oarepo_runtime-1.5.135.dist-info}/licenses/LICENSE +0 -0
- {oarepo_runtime-1.5.133.dist-info → oarepo_runtime-1.5.135.dist-info}/top_level.txt +0 -0
@@ -13,7 +13,7 @@ from .max_facet import MaxFacet
|
|
13
13
|
from .nested_facet import NestedLabeledFacet
|
14
14
|
from .params import FilteredFacetsParam, GroupedFacetsParam
|
15
15
|
from .year_histogram import YearAutoHistogramFacet
|
16
|
-
|
16
|
+
from .multilingual_facet import MultilingualFacet
|
17
17
|
__all__ = [
|
18
18
|
"LabelledValuesTermsFacet",
|
19
19
|
"DateFacet",
|
@@ -29,4 +29,5 @@ __all__ = [
|
|
29
29
|
"GroupedFacetsParam",
|
30
30
|
"FilteredFacetsParam",
|
31
31
|
"YearAutoHistogramFacet",
|
32
|
+
"MultilingualFacet"
|
32
33
|
]
|
@@ -0,0 +1,33 @@
|
|
1
|
+
from flask_babel import get_locale
|
2
|
+
from invenio_records_resources.services.records.facets import TermsFacet
|
3
|
+
|
4
|
+
class MultilingualFacet(TermsFacet):
|
5
|
+
|
6
|
+
def __init__(self, lang_facets, **kwargs):
|
7
|
+
|
8
|
+
self.lang_facets = lang_facets
|
9
|
+
|
10
|
+
super().__init__(**kwargs)
|
11
|
+
|
12
|
+
def get_aggregation(self):
|
13
|
+
return self.lang_facets[get_locale().language].get_aggregation()
|
14
|
+
|
15
|
+
def get_value(self, bucket):
|
16
|
+
"""Get key value for a bucket."""
|
17
|
+
return self.lang_facets[get_locale().language].get_value(bucket)
|
18
|
+
|
19
|
+
def get_label_mapping(self, buckets):
|
20
|
+
"""Overwrite this method to provide custom labelling."""
|
21
|
+
return self.lang_facets[get_locale().language].get_label_mapping(buckets)
|
22
|
+
|
23
|
+
def get_values(self, data, filter_values):
|
24
|
+
"""Get an unlabelled version of the bucket."""
|
25
|
+
return self.lang_facets[get_locale().language].get_values(data, filter_values)
|
26
|
+
|
27
|
+
def get_labelled_values(self, data, filter_values):
|
28
|
+
"""Get a labelled version of a bucket."""
|
29
|
+
return self.lang_facets[get_locale().language].get_labelled_values(data, filter_values)
|
30
|
+
|
31
|
+
def add_filter(self, filter_values):
|
32
|
+
"""Create a terms filter instead of bool containing term filters."""
|
33
|
+
return self.lang_facets[get_locale().language].add_filter(filter_values)
|
@@ -1,14 +1,19 @@
|
|
1
|
-
|
1
|
+
from functools import partial
|
2
2
|
|
3
|
-
|
4
|
-
from
|
5
|
-
from
|
6
|
-
from invenio_rdm_records.services.schemas.versions import VersionsSchema
|
3
|
+
import marshmallow as ma
|
4
|
+
from invenio_i18n.selectors import get_locale
|
5
|
+
from invenio_rdm_records.services.schemas.metadata import record_identifiers_schemes
|
7
6
|
from invenio_rdm_records.services.schemas.tombstone import DeletionStatusSchema
|
8
|
-
from invenio_rdm_records.services.schemas.
|
7
|
+
from invenio_rdm_records.services.schemas.versions import VersionsSchema
|
9
8
|
from invenio_vocabularies.contrib.awards.schema import AwardRelationSchema
|
10
9
|
from invenio_vocabularies.contrib.funders.schema import FunderRelationSchema
|
11
|
-
from
|
10
|
+
from marshmallow import fields as ma_fields
|
11
|
+
from marshmallow import pre_load
|
12
|
+
from marshmallow_utils.fields import (
|
13
|
+
IdentifierSet,
|
14
|
+
)
|
15
|
+
from marshmallow_utils.fields.nestedattr import NestedAttribute
|
16
|
+
from marshmallow_utils.schemas.identifier import IdentifierSchema
|
12
17
|
|
13
18
|
|
14
19
|
class RDMRecordMixin(ma.Schema):
|
@@ -33,3 +38,25 @@ class FundingSchema(ma.Schema):
|
|
33
38
|
|
34
39
|
funder = ma_fields.Nested(FunderRelationSchema, required=True)
|
35
40
|
award = ma_fields.Nested(MultilingualAwardSchema)
|
41
|
+
|
42
|
+
|
43
|
+
class RecordIdentifierField(IdentifierSet):
|
44
|
+
def __init__(self, *args, **kwargs):
|
45
|
+
super().__init__(
|
46
|
+
ma.fields.Nested(
|
47
|
+
partial(IdentifierSchema, allowed_schemes=record_identifiers_schemes)
|
48
|
+
),
|
49
|
+
*args,
|
50
|
+
**kwargs
|
51
|
+
)
|
52
|
+
|
53
|
+
|
54
|
+
class RelatedRecordIdentifierField(IdentifierSet):
|
55
|
+
def __init__(self, *args, **kwargs):
|
56
|
+
super().__init__(
|
57
|
+
ma.fields.Nested(
|
58
|
+
partial(IdentifierSchema, allowed_schemes=record_identifiers_schemes)
|
59
|
+
),
|
60
|
+
*args,
|
61
|
+
**kwargs
|
62
|
+
)
|
@@ -105,12 +105,13 @@ oarepo_runtime/services/entity/service.py,sha256=Y8QJ4sWZpX89IKTyo90pJlRfEN-iWg9
|
|
105
105
|
oarepo_runtime/services/expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
106
106
|
oarepo_runtime/services/expansions/expandable_fields.py,sha256=7DWKFL6ml8J7zGI6wm9LO7Xd6R0LSylsuq4lyRumNHQ,745
|
107
107
|
oarepo_runtime/services/expansions/service.py,sha256=HaEy76XOhDf__sQ91hi-8iH1hthM9q07pRhOmyZyVrs,144
|
108
|
-
oarepo_runtime/services/facets/__init__.py,sha256=
|
108
|
+
oarepo_runtime/services/facets/__init__.py,sha256=7FIw8B2UWaTUs6yGo74knzvE9T_rSrVRmLo9RA2Tgms,888
|
109
109
|
oarepo_runtime/services/facets/base.py,sha256=-IEUUY0hZcAh_3SelceTjMSw_SaqMhgnLxzG62iq7tA,421
|
110
110
|
oarepo_runtime/services/facets/date.py,sha256=Q0NP1YaCNHI6z11q927Wa41fBrzj4K08Ff-TPH2TLCg,2074
|
111
111
|
oarepo_runtime/services/facets/enum.py,sha256=3LrShQIt9Vt5mkqUkc6FNxXCW5JEFdPwtGCTEmNB6i0,396
|
112
112
|
oarepo_runtime/services/facets/facet_groups_names.py,sha256=RR8eeUmD8d9t966JqfhslZnILn_xDSfYlL0hjyJT92Y,468
|
113
113
|
oarepo_runtime/services/facets/max_facet.py,sha256=TZ4KMKKVJHzyU1KgNne4V7IMQPu1ALRpkz61Y0labrc,407
|
114
|
+
oarepo_runtime/services/facets/multilingual_facet.py,sha256=8L3uvk19n4Zy0vD-XnR7qW1qpse-rIPGyXNFh1qlizk,1307
|
114
115
|
oarepo_runtime/services/facets/nested_facet.py,sha256=y0xgjx37HsSj2xW7URxNemYTksD8hpPs7kOEfIBw22k,971
|
115
116
|
oarepo_runtime/services/facets/params.py,sha256=270La-A9582aDF3D4_bMSLWv4VsPeMiqbb9jA301Q5w,6585
|
116
117
|
oarepo_runtime/services/facets/year_histogram.py,sha256=kdfwx1lgw4UmfjdaqqeElJCB8rAduMH2hy42aZjY37w,6257
|
@@ -134,7 +135,7 @@ oarepo_runtime/services/schema/marshmallow.py,sha256=iAMMH5MlYs59qetXAHOROvERNSc
|
|
134
135
|
oarepo_runtime/services/schema/marshmallow_to_json_schema.py,sha256=VYLnVWHOoaxWCD_gqJO8-8u1SbaPEFBjDZ5HGgGr0Ow,2027
|
135
136
|
oarepo_runtime/services/schema/oneofschema.py,sha256=GnWH4Or_G5M0NgSmCoqMI6PBrJg5AC9RHrcB5QDKRq0,6661
|
136
137
|
oarepo_runtime/services/schema/polymorphic.py,sha256=bAbUoTIeDBiJPYPhpLEKKZekEdkHlpqkmNxk1hN3PDw,564
|
137
|
-
oarepo_runtime/services/schema/rdm.py,sha256=
|
138
|
+
oarepo_runtime/services/schema/rdm.py,sha256=TkWqtMlCosm4mL7nCHUW3RSGUQypk3wViTMwyqz2Ezs,2047
|
138
139
|
oarepo_runtime/services/schema/rdm_ui.py,sha256=oXV8wGFChL84Y1xtkhZ89eZ4Ngr6RV8iavf32e4nCVI,3544
|
139
140
|
oarepo_runtime/services/schema/ui.py,sha256=ae75YON8yNGxblywCgqX2OS9ACXHGzcN_adlLKIRUYk,7937
|
140
141
|
oarepo_runtime/services/schema/validation.py,sha256=aRfeR-2D1XXYqI3_U5FHoFvJrYjZlpM8nB35-M_u3Qs,2300
|
@@ -147,13 +148,13 @@ oarepo_runtime/translations/en/LC_MESSAGES/messages.po,sha256=7-5S3iINOSFSI5gVdR
|
|
147
148
|
oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
148
149
|
oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
|
149
150
|
oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
|
150
|
-
oarepo_runtime-1.5.
|
151
|
+
oarepo_runtime-1.5.135.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
|
151
152
|
tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
152
153
|
tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
|
153
154
|
tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
|
154
155
|
tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
155
|
-
oarepo_runtime-1.5.
|
156
|
-
oarepo_runtime-1.5.
|
157
|
-
oarepo_runtime-1.5.
|
158
|
-
oarepo_runtime-1.5.
|
159
|
-
oarepo_runtime-1.5.
|
156
|
+
oarepo_runtime-1.5.135.dist-info/METADATA,sha256=uMODFmdnyZJqbJaDsyHQN7LTXl0UHs2vL0OJfehbees,4743
|
157
|
+
oarepo_runtime-1.5.135.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
158
|
+
oarepo_runtime-1.5.135.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
|
159
|
+
oarepo_runtime-1.5.135.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
|
160
|
+
oarepo_runtime-1.5.135.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|