oarepo-runtime 1.5.134__py3-none-any.whl → 1.5.136__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.
@@ -1,21 +1,6 @@
1
- import marshmallow as ma
2
- from flask_resources import (
3
- JSONDeserializer,
4
- JSONSerializer,
5
- RequestBodyParser,
6
- ResponseHandler,
7
- )
8
- from invenio_drafts_resources.resources import RecordResourceConfig
9
- from invenio_rdm_records.resources.args import RDMSearchRequestArgsSchema
10
1
  from invenio_rdm_records.resources.config import (
11
2
  RDMRecordResourceConfig,
12
3
  )
13
- from invenio_records_resources.resources.records.headers import etag_headers
14
-
15
- record_serializers = {
16
- "application/json": ResponseHandler(JSONSerializer(), headers=etag_headers),
17
- }
18
-
19
4
 
20
5
  class BaseRecordResourceConfig(RDMRecordResourceConfig):
21
6
  """Record resource configuration."""
@@ -23,28 +8,5 @@ class BaseRecordResourceConfig(RDMRecordResourceConfig):
23
8
  blueprint_name = None
24
9
  url_prefix = None
25
10
 
26
- routes = RecordResourceConfig.routes
27
-
28
- routes["delete-record"] = "/<pid_value>/delete"
29
- routes["restore-record"] = "/<pid_value>/restore"
30
- routes["set-record-quota"] = "/<pid_value>/quota"
31
- routes["set-user-quota"] = "/users/<pid_value>/quota"
32
- routes["all-prefix"] = "/all"
33
-
34
- request_view_args = {
35
- "pid_value": ma.fields.Str(),
36
- }
37
-
38
- request_read_args = {
39
- "style": ma.fields.Str(),
40
- "locale": ma.fields.Str(),
41
- "include_deleted": ma.fields.Bool(),
42
- }
43
-
44
- request_body_parsers = {
45
- "application/json": RequestBodyParser(JSONDeserializer()),
46
- }
47
-
48
- request_search_args = RDMSearchRequestArgsSchema
49
-
50
- response_handlers = record_serializers
11
+ routes = RDMRecordResourceConfig.routes
12
+ routes["all-prefix"] = "/all"
@@ -12,7 +12,6 @@ from invenio_records_resources.resources.records.resource import (
12
12
  )
13
13
  from invenio_records_resources.resources.records.utils import search_preference
14
14
 
15
-
16
15
  class BaseRecordResource(RDMRecordResource):
17
16
 
18
17
  def create_url_rules(self):
@@ -29,11 +28,6 @@ class BaseRecordResource(RDMRecordResource):
29
28
  routes = self.config.routes
30
29
  url_rules = super(RDMRecordResource, self).create_url_rules()
31
30
  url_rules += [
32
- route("DELETE", p(routes["delete-record"]), self.delete_record),
33
- route("POST", p(routes["restore-record"]), self.restore_record),
34
- route("POST", p(routes["set-record-quota"]), self.set_record_quota),
35
- # TODO: move to users?
36
- route("POST", routes["set-user-quota"], self.set_user_quota),
37
31
  route("GET", s(routes["all-prefix"]), self.search_all_records),
38
32
  ]
39
33
 
@@ -100,3 +100,18 @@ class PermissionsPresetsConfigMixin:
100
100
  name = name[:-6]
101
101
  name = re.sub(r"(?<!^)(?=[A-Z])", "_", name).upper()
102
102
  return f"{name}_PERMISSIONS_PRESETS"
103
+
104
+ class SearchAllConfigMixin:
105
+ @property
106
+ def search_all(self):
107
+ from invenio_rdm_records.services.search_params import MyDraftsParam
108
+ if hasattr(self, "search_drafts"):
109
+ class AllSearchOptions(self.search_drafts):
110
+ @class_property
111
+ def params_interpreters_cls(cls):
112
+ param_interpreters = [*super().params_interpreters_cls]
113
+ param_interpreters.remove(MyDraftsParam)
114
+ return param_interpreters
115
+ return AllSearchOptions
116
+ else:
117
+ return self.search
@@ -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)
@@ -30,7 +30,7 @@ class SearchAllRecordsService(RDMRecordService):
30
30
  params = params or {}
31
31
 
32
32
  search_opts = (
33
- getattr(self.config, "search_all", None) or self.config.search_drafts
33
+ getattr(self.config, "search_all", None) or self.config.search
34
34
  )
35
35
 
36
36
  search_result = self._search(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: oarepo-runtime
3
- Version: 1.5.134
3
+ Version: 1.5.136
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -79,23 +79,23 @@ oarepo_runtime/records/systemfields/record_status.py,sha256=U3kem4-JkNsT17e0iAl3
79
79
  oarepo_runtime/records/systemfields/selectors.py,sha256=Q9jE1smSN3heT2LIpK_jB6bIRjll1kX0AW9AhTsIYiU,2830
80
80
  oarepo_runtime/records/systemfields/synthetic.py,sha256=UustvhzcDGuaNZLDeHbWwshoxQR-qRIuHDCct5RXmrI,4287
81
81
  oarepo_runtime/resources/__init__.py,sha256=v8BGrOTu_FjKzd0eozV7Q4GoGxyfybsL2cI-tbP5Pys,185
82
- oarepo_runtime/resources/config.py,sha256=GEM3A7lvGgWUdhBR85uJbaQDKg2-Xk5U-Jm4JmogfFg,1414
82
+ oarepo_runtime/resources/config.py,sha256=34kfNh2hVYYS9q1CYziiNdFzTvDuSXKd4W1n1OQtm-c,308
83
83
  oarepo_runtime/resources/file_resource.py,sha256=Ta3bFce7l0xwqkkOMOEu9mxbB8BbKj5HUHRHmidhnl8,414
84
84
  oarepo_runtime/resources/json_serializer.py,sha256=82_-xQEtxKaPakv8R1oBAFbGnxskF_Ve4tcfcy4PetI,963
85
85
  oarepo_runtime/resources/localized_ui_json_serializer.py,sha256=3V9cJaG_e1PMXKVX_wKfBp1LmbeForwHyBNYdyha4uQ,1878
86
- oarepo_runtime/resources/resource.py,sha256=GK5yGnJIjH60wGqqDoOfwMQQFQDLZhJpU4zBJOmABI8,2063
86
+ oarepo_runtime/resources/resource.py,sha256=dSpaPW6l_kTTzaq5LkZODyOzbL_T3-lU2uX65SQ46gE,1718
87
87
  oarepo_runtime/resources/responses.py,sha256=Pj-K_r-QO9B2n9STcfqsrBQu1e3iYhdEBFSVTeWR7cM,738
88
88
  oarepo_runtime/services/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
89
89
  oarepo_runtime/services/components.py,sha256=0aqmuNbGCQhfOI22f6mM2DxuKSTqstGOGyisOiqw9KE,15481
90
90
  oarepo_runtime/services/generators.py,sha256=j87HitHA_w2awsz0C5IAAJ0qjg9JMtvdO3dvh6FQyfg,250
91
91
  oarepo_runtime/services/results.py,sha256=MxkoMkquISMKyP6De_xOF-IzQE9wRYtq3d_OFAqqIVo,6156
92
92
  oarepo_runtime/services/search.py,sha256=t0WEe2VrbCzZ06-Jgz7C9-pc9y27BqAgTEXldEHskfk,9409
93
- oarepo_runtime/services/service.py,sha256=TI2ulEVlSR7HZnfPYltLl8Vf4O9fhJ7rHaV6G4HWbrc,1893
93
+ oarepo_runtime/services/service.py,sha256=-Cd7R6Y8UW01Gsyprhtm4-iyBVBKFs4kOaka7mUGH7o,1886
94
94
  oarepo_runtime/services/config/__init__.py,sha256=aRxCBLN9pqCgdYlF-KJYtDzt2mwJ66npdceOAZkMfa0,888
95
95
  oarepo_runtime/services/config/draft_link.py,sha256=Hq541t33F3lEZo6XTexzdxneKJOmLBLujFdyT1w1TbE,698
96
96
  oarepo_runtime/services/config/link_conditions.py,sha256=5hDEtCaQt1tzjb9gGdeimsmKNoWWPicIeYKfI8Fg8Qw,3866
97
97
  oarepo_runtime/services/config/permissions_presets.py,sha256=b1wm3JjL8KgkaH7VMkNfdMk5fXtf3X87rB7gkvaNxns,7369
98
- oarepo_runtime/services/config/service.py,sha256=s-dVbGkLICpsce6jgu7b5kzYFz9opWjSQFDBgbIhKio,4002
98
+ oarepo_runtime/services/config/service.py,sha256=KS1eKXjRzusD_UAKanzKezua2lmo9vObwqd63dky1ik,4593
99
99
  oarepo_runtime/services/custom_fields/__init__.py,sha256=_gqMcA_I3rdEZcBtCuDjO4wdVCqFML5NzaccuPx5a3o,2565
100
100
  oarepo_runtime/services/custom_fields/mappings.py,sha256=3CIvjWzVRO3fZ2r-3taK1rwuLH9wj5Lguo-GvsbLBf4,7515
101
101
  oarepo_runtime/services/entity/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -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.136.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.136.dist-info/METADATA,sha256=foAVOZLkwGL0Cy5jxIjhykmpwEkVxTHp8ry3C2zBIR4,4743
157
+ oarepo_runtime-1.5.136.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
158
+ oarepo_runtime-1.5.136.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
159
+ oarepo_runtime-1.5.136.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
160
+ oarepo_runtime-1.5.136.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.7.1)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5