oarepo-runtime 1.5.112__py3-none-any.whl → 1.5.114__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.
@@ -173,6 +173,8 @@ class RelationResult:
173
173
 
174
174
  def resolve(self, id_):
175
175
  raise NotImplementedError("Please implement this method in your subclass")
176
+
177
+
176
178
  class UnstrictRelationResult(RelationResult):
177
179
 
178
180
  def _resolve_lookup_result(self, relation):
@@ -180,6 +182,8 @@ class UnstrictRelationResult(RelationResult):
180
182
  raise InvalidRelationValue(
181
183
  f"Value at path {relation.path} must be dict, found {relation.value}"
182
184
  )
185
+ if "id" not in relation.value:
186
+ return relation.value
183
187
  relation_id = self._lookup_id(relation)
184
188
  resolved_object = self.resolve(relation_id, relation.value)
185
189
  if not resolved_object:
@@ -199,8 +203,6 @@ class UnstrictRelationResult(RelationResult):
199
203
  return data
200
204
 
201
205
 
202
-
203
-
204
206
  class Relation:
205
207
  result_cls = RelationResult
206
208
 
@@ -1,7 +1,7 @@
1
1
  import marshmallow as ma
2
2
  from oarepo_runtime.services.schema.marshmallow import DictOnlySchema
3
3
  from oarepo_vocabularies.services.ui_schema import VocabularyI18nStrUIField
4
-
4
+ from idutils import to_url
5
5
 
6
6
  class RDMIdentifierWithSchemaUISchema(ma.Schema):
7
7
  scheme = ma.fields.String(
@@ -9,6 +9,16 @@ class RDMIdentifierWithSchemaUISchema(ma.Schema):
9
9
  )
10
10
  identifier = ma.fields.String(required=True)
11
11
 
12
+ @ma.post_dump
13
+ def add_url(self, value, **kwargs):
14
+ if "identifier" in value and "scheme" in value:
15
+ url = to_url(
16
+ value["identifier"], value["scheme"].lower(), url_scheme="https"
17
+ )
18
+ if url:
19
+ value["url"] = url
20
+ return value
21
+
12
22
 
13
23
  class RDMAwardIdentifierUISchema(ma.Schema):
14
24
  identifier = ma.fields.String()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oarepo-runtime
3
- Version: 1.5.112
3
+ Version: 1.5.114
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -63,7 +63,7 @@ oarepo_runtime/records/mappings/rdm_parent_mapping.json,sha256=9yRjlGs8-TZZiKN9M
63
63
  oarepo_runtime/records/owners/__init__.py,sha256=R4hudCBqLRRzgCnkEjXIL7hSp068z-s6YOwYSkWyuaw,93
64
64
  oarepo_runtime/records/owners/registry.py,sha256=fYgBuW5nBKn6pyz2OBgfNlynk64_yhQ9J7FzPk8QU1U,795
65
65
  oarepo_runtime/records/relations/__init__.py,sha256=Zn7JeQrd5f1doWl5IpbNSpO8m8hm1m-oljAW-7WHn-k,477
66
- oarepo_runtime/records/relations/base.py,sha256=gTXvyxdkKZ_khdoqvShE2mIbPDU91Bf9beTxHwQtyFk,9925
66
+ oarepo_runtime/records/relations/base.py,sha256=H_8OPO35WQlbvnDi1LKltmCgoBn1HF40b03xveH09p0,9998
67
67
  oarepo_runtime/records/relations/internal.py,sha256=OTp8iJqyl80sWDk0Q0AK42l6UsxZDABspVU_GwWza9o,1556
68
68
  oarepo_runtime/records/relations/lookup.py,sha256=wi3jPfOedazOmhOMrgu50PUETc1jfSdpmjK0wvOFsEM,848
69
69
  oarepo_runtime/records/relations/pid_relation.py,sha256=eojw5uIo5zXmJGge_bj6Wj2njCRY5S4o4B_h_HFyaDY,3901
@@ -131,7 +131,7 @@ oarepo_runtime/services/schema/marshmallow_to_json_schema.py,sha256=VYLnVWHOoaxW
131
131
  oarepo_runtime/services/schema/oneofschema.py,sha256=GnWH4Or_G5M0NgSmCoqMI6PBrJg5AC9RHrcB5QDKRq0,6661
132
132
  oarepo_runtime/services/schema/polymorphic.py,sha256=bAbUoTIeDBiJPYPhpLEKKZekEdkHlpqkmNxk1hN3PDw,564
133
133
  oarepo_runtime/services/schema/rdm.py,sha256=dBy1KCJ_XYAN_cffoRqLfQVEdZOKwmSpqGdEP4OL64k,1280
134
- oarepo_runtime/services/schema/rdm_ui.py,sha256=KO7UGrejhaFa65CdcQ96K7jpQSdj_35CYa2pwpgxf1s,3051
134
+ oarepo_runtime/services/schema/rdm_ui.py,sha256=x1cWvGbmmB1GNKu4Hyl65tc_j5TiKsyZm8Y2JQyHEB4,3389
135
135
  oarepo_runtime/services/schema/ui.py,sha256=hHbj1S-DW1WqgYX31f6UjarY4wrE-qFLpH3oUhvGLyE,6192
136
136
  oarepo_runtime/services/schema/validation.py,sha256=VFOKSxQLHwFb7bW8BJAFXWe_iTAZFOfqOnb2Ko_Yxxc,2085
137
137
  oarepo_runtime/translations/default_translations.py,sha256=060GBlA1ghWxfeumo6NqxCCZDb-6OezOuF6pr-_GEOQ,104
@@ -147,9 +147,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
147
147
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
148
148
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
149
149
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
150
- oarepo_runtime-1.5.112.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
151
- oarepo_runtime-1.5.112.dist-info/METADATA,sha256=FIFAT3sYW6SKrJBMWejDRJ-HemcYYvZq4ZrPesVGShg,4721
152
- oarepo_runtime-1.5.112.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
153
- oarepo_runtime-1.5.112.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
154
- oarepo_runtime-1.5.112.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
155
- oarepo_runtime-1.5.112.dist-info/RECORD,,
150
+ oarepo_runtime-1.5.114.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
151
+ oarepo_runtime-1.5.114.dist-info/METADATA,sha256=ek8EiFhceraeV4Zk0IhGkvfAJy6AVu4yObiC1B2SpkE,4721
152
+ oarepo_runtime-1.5.114.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
153
+ oarepo_runtime-1.5.114.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
154
+ oarepo_runtime-1.5.114.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
155
+ oarepo_runtime-1.5.114.dist-info/RECORD,,