oarepo-runtime 1.5.60__py3-none-any.whl → 1.5.62__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -25,7 +25,6 @@ from invenio_base.utils import obj_or_import_string
25
25
  from invenio_jsonschemas import current_jsonschemas
26
26
  from invenio_records_resources.proxies import current_service_registry
27
27
 
28
-
29
28
  logger = logging.getLogger("oarepo_runtime.info")
30
29
 
31
30
 
@@ -72,7 +71,7 @@ class InfoResource(Resource):
72
71
  "models": url_for("oarepo_runtime_info.models", _external=True),
73
72
  }
74
73
  try:
75
- import invenio_requests # noqa
74
+ import invenio_requests # noqa
76
75
  links["requests"] = api_url_for("requests.search", _external=True)
77
76
  except ImportError:
78
77
  pass
@@ -111,19 +110,27 @@ class InfoResource(Resource):
111
110
  if not service or type(service) != service_class:
112
111
  continue
113
112
 
113
+ # check if the service class is inside OAREPO_GLOBAL_SEARCH and if not, skip it
114
+ global_search_models = current_app.config.get('GLOBAL_SEARCH_MODELS', [])
115
+ for global_model in global_search_models:
116
+ if global_model['model_service'] == model_data["service"]["class"]:
117
+ break
118
+ else:
119
+ continue
120
+
114
121
  model_features = self._get_model_features(model_data)
115
122
 
116
123
  links = {
117
124
  "api": self._get_model_api_endpoint(model_data),
118
125
  "html": self._get_model_html_endpoint(model_data),
119
- "schema": self._get_model_schema_endpoint(model_data),
126
+ "schemas": self._get_model_schema_endpoints(model_data),
120
127
  "model": self._get_model_model_endpoint(model.name),
121
128
  # "openapi": url_for(self._get_model_openapi_endpoint(model_data), _external=True)
122
129
  }
123
130
 
124
131
  links["published"] = links["api"]
125
132
  if "drafts" in model_features:
126
- links["drafts"] = self._get_model_draft_endpoint(model_data)
133
+ links["user_records"] = self._get_model_draft_endpoint(model_data)
127
134
 
128
135
  data.append(
129
136
  {
@@ -153,7 +160,7 @@ class InfoResource(Resource):
153
160
  def model(self):
154
161
  model = resource_requestctx.view_args["model"]
155
162
  for _model in importlib_metadata.entry_points().select(
156
- group="oarepo.models", name=model
163
+ group="oarepo.models", name=model
157
164
  ):
158
165
  package_name, file_name = _model.value.split(":")
159
166
  model_data = json.loads(
@@ -246,13 +253,15 @@ class InfoResource(Resource):
246
253
  logger.exception("Failed to get model html endpoint")
247
254
  return None
248
255
 
249
- def _get_model_schema_endpoint(self, model):
256
+ def _get_model_schema_endpoints(self, model):
250
257
  try:
251
- return url_for(
252
- "oarepo_runtime_info.schema",
253
- schema=model["json-schema-settings"]["name"],
254
- _external=True,
255
- )
258
+ return {
259
+ 'application/json': url_for(
260
+ "oarepo_runtime_info.schema",
261
+ schema=model["json-schema-settings"]["name"],
262
+ _external=True,
263
+ )
264
+ }
256
265
  except: # NOSONAR noqa
257
266
  logger.exception("Failed to get model schema endpoint")
258
267
  return None
@@ -269,10 +278,10 @@ class InfoResource(Resource):
269
278
  record_cls = service.config.record_cls
270
279
  schema = getattr(record_cls, "schema", None)
271
280
  if schema is not None:
272
- return [schema.value]
281
+ return {"application/json": schema.value}
273
282
  except: # NOSONAR noqa
274
283
  logger.exception("Failed to get model schemas")
275
- return []
284
+ return {}
276
285
 
277
286
  def _get_service(self, model_data):
278
287
  service_id = model_data["service-config"]["service-id"]
@@ -35,6 +35,8 @@ class PIDRelationResult(RelationResult):
35
35
 
36
36
  try:
37
37
  obj = pid_field_context.resolve(id_)
38
+ if hasattr(obj, "relations") and obj.relations and hasattr(obj.relations, "dereference"):
39
+ obj.relations.dereference()
38
40
  # We detach the related record model from the database session when
39
41
  # we add it in the cache. Otherwise, accessing the cached record
40
42
  # model, will execute a new select query after a db.session.commit.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: oarepo-runtime
3
- Version: 1.5.60
3
+ Version: 1.5.62
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -41,7 +41,7 @@ oarepo_runtime/datastreams/writers/validation_errors.py,sha256=wOCXdniR6so_4Expd
41
41
  oarepo_runtime/datastreams/writers/yaml.py,sha256=XchUJHQ58E2Mfgs8elImXbL38jFtI8Hfoye6yaR0gKI,1482
42
42
  oarepo_runtime/i18n/__init__.py,sha256=h0knW_HwiyIt5TBHfdGqN7_BBYfpz1Fw6zhVy0C28fM,111
43
43
  oarepo_runtime/info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
44
- oarepo_runtime/info/views.py,sha256=YdjzwPhG5YxRfz-7WLvHlqrlHi98rmKEcZpdN4opUII,11342
44
+ oarepo_runtime/info/views.py,sha256=UkLGzf6Vo8GLutfzJW3IAyq9sdPexICUFAvz903autY,11829
45
45
  oarepo_runtime/records/__init__.py,sha256=3vzRsAPxl4d5QOnGyls-vUg4E6PunmR4ACObtacMAIQ,1038
46
46
  oarepo_runtime/records/dumpers/__init__.py,sha256=OmzNhLdMNKibmCksnj9eTX9xPBG30dziiK3j3bAAp3k,233
47
47
  oarepo_runtime/records/dumpers/edtf_interval.py,sha256=YCShZAoqBQYaxVilEVotS-jXZsxxoXO67yu2urhkaMA,1198
@@ -54,7 +54,7 @@ oarepo_runtime/records/relations/__init__.py,sha256=bDAgxl_LdKsqpGG3qluxAkQnn5u2
54
54
  oarepo_runtime/records/relations/base.py,sha256=XQpRt6-MfIKIClZ0IoGJr0GGl2Ru3RcqMoowOxrFG_E,8981
55
55
  oarepo_runtime/records/relations/internal.py,sha256=OTp8iJqyl80sWDk0Q0AK42l6UsxZDABspVU_GwWza9o,1556
56
56
  oarepo_runtime/records/relations/lookup.py,sha256=wi3jPfOedazOmhOMrgu50PUETc1jfSdpmjK0wvOFsEM,848
57
- oarepo_runtime/records/relations/pid_relation.py,sha256=zJjSf_ocFBViYsOuMMZLbQZpNZeKiOK33dPD4tk74Qo,2786
57
+ oarepo_runtime/records/relations/pid_relation.py,sha256=jKiwUEepJkOc0MRX3Etl5RQJw3t40rY7FOJCIPwOKmg,2932
58
58
  oarepo_runtime/records/systemfields/__init__.py,sha256=SPaMWM6t-azz6gZLUKvvXbOyE2_-LW6i_szQk8nhbAc,455
59
59
  oarepo_runtime/records/systemfields/featured_file.py,sha256=MbSaYR130_o5S9gEOblnChq-PVK4xGPGpSCrzwG3cwc,1720
60
60
  oarepo_runtime/records/systemfields/has_draftcheck.py,sha256=4JkMEefPLpqtPtlTgK3UT0KzTRgyw5_Qtkss2qcz5xk,1643
@@ -119,9 +119,9 @@ oarepo_runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hS
119
119
  oarepo_runtime/utils/functools.py,sha256=gKS9YZtlIYcDvdNA9cmYO00yjiXBYV1jg8VpcRUyQyg,1324
120
120
  oarepo_runtime/utils/path.py,sha256=V1NVyk3m12_YLbj7QHYvUpE1wScO78bYsX1LOLeXDkI,3108
121
121
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
- oarepo_runtime-1.5.60.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
123
- oarepo_runtime-1.5.60.dist-info/METADATA,sha256=8HAOuGW8hqgI2E1df2A-ux-WdXPlA5fMM7TFvok8hTY,4720
124
- oarepo_runtime-1.5.60.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
125
- oarepo_runtime-1.5.60.dist-info/entry_points.txt,sha256=QrlXAKuPDVBinaSh_v3yO9_Nb9ZNmJCJ0VFcCW-z0Jg,327
126
- oarepo_runtime-1.5.60.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
127
- oarepo_runtime-1.5.60.dist-info/RECORD,,
122
+ oarepo_runtime-1.5.62.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
123
+ oarepo_runtime-1.5.62.dist-info/METADATA,sha256=WsZXpIjGMDuilC_1VyfG3eGhd6OTq5SzlnJLqPs3TjM,4720
124
+ oarepo_runtime-1.5.62.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
125
+ oarepo_runtime-1.5.62.dist-info/entry_points.txt,sha256=QrlXAKuPDVBinaSh_v3yO9_Nb9ZNmJCJ0VFcCW-z0Jg,327
126
+ oarepo_runtime-1.5.62.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
127
+ oarepo_runtime-1.5.62.dist-info/RECORD,,