oarepo-runtime 1.5.134__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.
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oarepo-runtime
3
- Version: 1.5.134
3
+ Version: 1.5.135
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -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=Pq7xDiev2j3k8C55QyTXZWnUuRnRZUKWLi5ymZQgOOw,815
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
@@ -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.134.dist-info/licenses/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
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.134.dist-info/METADATA,sha256=ULtV0UvrWzxilo4uh30rjFK794pJswnkz1j0CJg-aKg,4743
156
- oarepo_runtime-1.5.134.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
157
- oarepo_runtime-1.5.134.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
158
- oarepo_runtime-1.5.134.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
159
- oarepo_runtime-1.5.134.dist-info/RECORD,,
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,,