oarepo-runtime 1.5.100__py3-none-any.whl → 1.5.102__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,4 +1,5 @@
1
1
  import json
2
+ from collections.abc import Mapping, Sequence, Set
2
3
 
3
4
  import click
4
5
  from flask import current_app
@@ -7,14 +8,28 @@ from werkzeug.local import LocalProxy
7
8
 
8
9
  from .base import oarepo
9
10
 
11
+ def remove_lazy_objects(obj):
12
+ if isinstance(obj, Sequence):
13
+ if isinstance(obj, list):
14
+ return [remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy)]
15
+ elif isinstance(obj, tuple):
16
+ return tuple(remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy))
17
+ elif not isinstance(obj, LocalProxy):
18
+ return obj # strings, bytes, bytesarray etc.
19
+ elif isinstance(obj, Set):
20
+ if isinstance(obj, frozenset):
21
+ return frozenset(remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy))
22
+ return {remove_lazy_objects(item) for item in obj if not isinstance(item, LocalProxy)}
23
+ elif isinstance(obj, Mapping):
24
+ return {k: remove_lazy_objects(v) for k, v in obj.items() if not isinstance(v, LocalProxy)}
25
+ elif not isinstance(obj, LocalProxy):
26
+ return obj # everything else that is not localproxy
10
27
 
11
28
  @oarepo.command(name="configuration")
12
29
  @click.argument("output_file", default="-")
13
30
  @with_appcontext
14
31
  def configuration_command(output_file):
15
- configuration = {
16
- k: v for k, v in current_app.config.items() if not isinstance(v, LocalProxy)
17
- }
32
+ configuration = remove_lazy_objects(current_app.config)
18
33
 
19
34
  try:
20
35
  invenio_db = current_app.extensions["invenio-db"]
@@ -33,4 +48,4 @@ def configuration_command(output_file):
33
48
  )
34
49
  else:
35
50
  with open(output_file, "w") as f:
36
- json.dump(configuration, f, skipkeys=True, ensure_ascii=False, default=lambda x: str(x))
51
+ json.dump(configuration, f,skipkeys=True, ensure_ascii=False, default=lambda x: str(x))
@@ -20,9 +20,9 @@ class EDTFIntervalDumperExt(SearchDumperExt):
20
20
  rec = rec.split("/")
21
21
  search_range = {}
22
22
  if rec[0]:
23
- search_range["gte"] = rec[0]
24
- if rec[1]:
25
- search_range["lte"] = rec[1]
23
+ search_range["gte"] = rec[0].strip()
24
+ if len(rec) > 1 and rec[1]:
25
+ search_range["lte"] = rec[1].strip()
26
26
  path[-1].parent_data[path[-1].key] = search_range
27
27
  return data
28
28
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: oarepo-runtime
3
- Version: 1.5.100
3
+ Version: 1.5.102
4
4
  Summary: A set of runtime extensions of Invenio repository
5
5
  Description-Content-Type: text/markdown
6
6
  License-File: LICENSE
@@ -10,7 +10,7 @@ oarepo_runtime/cli/assets.py,sha256=ZG80xIOKch7rsU_7QlvZxBQAXNQ9ow5xLsUREsl5MEE,
10
10
  oarepo_runtime/cli/base.py,sha256=94RBTa8TOSPxEyEUmYLGXaWen-XktP2-MIbTtZSlCZo,544
11
11
  oarepo_runtime/cli/cf.py,sha256=W0JEJK2JqKubQw8qtZJxohmADDRUBode4JZAqYLDGvc,339
12
12
  oarepo_runtime/cli/check.py,sha256=sCe2PeokSHvNOXHFZ8YHF8NMhsu5nYjyuZuvXHJ6X18,5092
13
- oarepo_runtime/cli/configuration.py,sha256=_iMmESs2dd1Oif95gxgpnkSxc13ymwr82_sTJfxlhrM,1091
13
+ oarepo_runtime/cli/configuration.py,sha256=M_19zrS0vo-7uHi047a3i4rQsK6pmp4QS0IEBAxMLZ0,2039
14
14
  oarepo_runtime/cli/fixtures.py,sha256=l6zHpz1adjotrbFy_wcN2TOL8x20i-1jbQmaoEEo-UU,5419
15
15
  oarepo_runtime/cli/index.py,sha256=KH5PArp0fCNbgJI1zSz0pb69U9eyCdnJuy0aMIgf2tg,8685
16
16
  oarepo_runtime/cli/validate.py,sha256=HpSvHQCGHlrdgdpKix9cIlzlBoJEiT1vACZdMnOUGEY,2827
@@ -53,7 +53,7 @@ oarepo_runtime/info/permissions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm
53
53
  oarepo_runtime/info/permissions/debug.py,sha256=2gak5W64g_AAZoX8cCII2di4G_jBo1ZvnU5ceP_u6z4,6722
54
54
  oarepo_runtime/records/__init__.py,sha256=JUf9_o09_6q4vuG43JzhSeTu7c-m_CVDSmgTQ7epYEo,1776
55
55
  oarepo_runtime/records/dumpers/__init__.py,sha256=OmzNhLdMNKibmCksnj9eTX9xPBG30dziiK3j3bAAp3k,233
56
- oarepo_runtime/records/dumpers/edtf_interval.py,sha256=YCShZAoqBQYaxVilEVotS-jXZsxxoXO67yu2urhkaMA,1198
56
+ oarepo_runtime/records/dumpers/edtf_interval.py,sha256=8bE3JlaR7b33rxDc7LW9R8jcwNI66Zb07Jee6YUmlrE,1231
57
57
  oarepo_runtime/records/dumpers/multilingual_dumper.py,sha256=PbNFCLsiH4XV3E1v8xga_fzlcEImHy8OXn_UKh_8VBU,1090
58
58
  oarepo_runtime/records/entity_resolvers/__init__.py,sha256=UiiIT54pUu9j7qPAPfqVp4UTnXnppp0c_LtKbFnyt6Y,383
59
59
  oarepo_runtime/records/entity_resolvers/proxies.py,sha256=R92Cil_sTgX-sHJtdNv82yd-F3SUfsGSNCHdwI9Zfq8,1516
@@ -142,9 +142,9 @@ tests/marshmallow_to_json/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
142
142
  tests/marshmallow_to_json/test_datacite_ui_schema.py,sha256=82iLj8nW45lZOUewpWbLX3mpSkpa9lxo-vK-Qtv_1bU,48552
143
143
  tests/marshmallow_to_json/test_simple_schema.py,sha256=izZN9p0v6kovtSZ6AdxBYmK_c6ZOti2_z_wPT_zXIr0,1500
144
144
  tests/pkg_data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
145
- oarepo_runtime-1.5.100.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
146
- oarepo_runtime-1.5.100.dist-info/METADATA,sha256=Pv0Sq-lTvfpaoq3baSsGxFfNWXpeMwEQQexb16JrSeQ,4721
147
- oarepo_runtime-1.5.100.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
148
- oarepo_runtime-1.5.100.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
149
- oarepo_runtime-1.5.100.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
150
- oarepo_runtime-1.5.100.dist-info/RECORD,,
145
+ oarepo_runtime-1.5.102.dist-info/LICENSE,sha256=h2uWz0OaB3EN-J1ImdGJZzc7yvfQjvHVYdUhQ-H7ypY,1064
146
+ oarepo_runtime-1.5.102.dist-info/METADATA,sha256=Gzch2ffpJDzH8HdjdKtaaQ5DX0xzAZTGYT0aOTwA5hI,4721
147
+ oarepo_runtime-1.5.102.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
148
+ oarepo_runtime-1.5.102.dist-info/entry_points.txt,sha256=k7O5LZUOGsVeSpB7ulU0txBUNp1CVQG7Q7TJIVTPbzU,491
149
+ oarepo_runtime-1.5.102.dist-info/top_level.txt,sha256=bHhlkT1_RQC4IkfTQCqA3iN4KCB6cSFQlsXpQMSP-bE,21
150
+ oarepo_runtime-1.5.102.dist-info/RECORD,,