invenio-app-rdm 13.0.0b2.dev12__py2.py3-none-any.whl → 13.0.0b2.dev14__py2.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.
@@ -17,6 +17,6 @@
17
17
  #
18
18
  # See PEP 0440 for details - https://www.python.org/dev/peps/pep-0440
19
19
 
20
- __version__ = "13.0.0b2.dev12"
20
+ __version__ = "13.0.0b2.dev14"
21
21
 
22
22
  __all__ = ("__version__",)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2019-2024 CERN.
3
+ # Copyright (C) 2019-2025 CERN.
4
4
  # Copyright (C) 2019-2022 Northwestern University.
5
5
  # Copyright (C) 2022 TU Wien.
6
6
  # Copyright (C) 2023-2024 Graz University of Technology.
@@ -9,18 +9,13 @@
9
9
  # under the terms of the MIT License; see LICENSE file for more details.
10
10
  """Communities UI blueprints module."""
11
11
 
12
- from flask import Blueprint, current_app, render_template, request
13
- from flask_login import current_user
14
- from invenio_communities.communities.resources.serializer import (
15
- UICommunityJSONSerializer,
16
- )
12
+ from flask import Blueprint, current_app, request
17
13
  from invenio_communities.errors import CommunityDeletedError
18
14
  from invenio_communities.views.ui import (
19
15
  not_found_error,
20
16
  record_permission_denied_error,
21
17
  record_tombstone_error,
22
18
  )
23
- from invenio_i18n import lazy_gettext as _
24
19
  from invenio_pidstore.errors import PIDDeletedError, PIDDoesNotExistError
25
20
  from invenio_rdm_records.collections import search_app_context as c_search_app_context
26
21
  from invenio_records_resources.services.errors import (
@@ -28,6 +23,8 @@ from invenio_records_resources.services.errors import (
28
23
  RecordPermissionDeniedError,
29
24
  )
30
25
 
26
+ from invenio_app_rdm.views import create_url_rule
27
+
31
28
  from ..searchapp import search_app_context
32
29
  from .communities import (
33
30
  communities_browse,
@@ -58,29 +55,24 @@ def create_ui_blueprint(app):
58
55
  )
59
56
 
60
57
  blueprint.add_url_rule(
61
- routes["community-detail"],
62
- view_func=communities_detail,
58
+ **create_url_rule(routes["community-detail"], communities_detail),
63
59
  strict_slashes=False,
64
60
  )
65
61
 
66
62
  blueprint.add_url_rule(
67
- routes["community-home"],
68
- view_func=communities_home,
63
+ **create_url_rule(routes["community-home"], communities_home)
69
64
  )
70
65
 
71
66
  blueprint.add_url_rule(
72
- routes["community-browse"],
73
- view_func=communities_browse,
67
+ **create_url_rule(routes["community-browse"], communities_browse)
74
68
  )
75
69
 
76
70
  blueprint.add_url_rule(
77
- routes["community-static-page"],
78
- view_func=community_static_page,
71
+ **create_url_rule(routes["community-static-page"], community_static_page)
79
72
  )
80
73
 
81
74
  blueprint.add_url_rule(
82
- routes["community-collection"],
83
- view_func=community_collection,
75
+ **create_url_rule(routes["community-collection"], community_collection)
84
76
  )
85
77
  # Register error handlers
86
78
  blueprint.register_error_handler(
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2019-2021 CERN.
3
+ # Copyright (C) 2019-2025 CERN.
4
4
  # Copyright (C) 2019-2022 Northwestern University.
5
5
  # Copyright (C) 2021 TU Wien.
6
6
  #
@@ -23,7 +23,8 @@ from invenio_records_resources.services.errors import (
23
23
  RecordPermissionDeniedError,
24
24
  )
25
25
 
26
- from ...theme.views import create_url_rule
26
+ from invenio_app_rdm.views import create_url_rule
27
+
27
28
  from ..searchapp import search_app_context
28
29
  from .deposits import community_upload, deposit_create, deposit_edit
29
30
  from .filters import (
@@ -53,9 +53,10 @@ def _resolve_topic_record(request):
53
53
  user_owns_request = str(creator_id) == str(current_user.id)
54
54
 
55
55
  if request["is_closed"] and not user_owns_request:
56
- return dict(permissions={}, record_ui=None, record=None)
56
+ return dict(permissions={}, record_ui=None, record=None, record_uuid=None)
57
57
 
58
58
  record = None
59
+ record_uuid = None
59
60
  # parse the topic field to get the draft/record pid `record:abcd-efgh`
60
61
  entity = ResolverRegistry.resolve_entity_proxy(request["topic"])
61
62
  pid = entity._parse_ref_dict_id()
@@ -84,11 +85,15 @@ def _resolve_topic_record(request):
84
85
  break
85
86
  # read published record
86
87
  record = current_rdm_records_service.read(g.identity, pid, expand=True)
88
+ record_uuid = current_rdm_records_service.record_cls.pid.resolve(pid).id
87
89
  else:
88
90
  # read draft
89
91
  record = current_rdm_records_service.read_draft(
90
92
  g.identity, pid, expand=True
91
93
  )
94
+ record_uuid = current_rdm_records_service.draft_cls.pid.resolve(
95
+ pid, registered_only=False
96
+ ).id
92
97
  except (NoResultFound, PIDDoesNotExistError):
93
98
  # We catch PIDDoesNotExistError because a published record with
94
99
  # a soft-deleted draft will raise this error. The lines below
@@ -98,6 +103,7 @@ def _resolve_topic_record(request):
98
103
  try:
99
104
  # read published record
100
105
  record = current_rdm_records_service.read(g.identity, pid, expand=True)
106
+ record_uuid = current_rdm_records_service.record_cls.pid.resolve(pid).id
101
107
  except NoResultFound:
102
108
  # record tab not displayed when the record is not found
103
109
  # the request is probably not open anymore
@@ -116,9 +122,14 @@ def _resolve_topic_record(request):
116
122
  "read",
117
123
  ]
118
124
  )
119
- return dict(permissions=permissions, record_ui=record_ui, record=record)
125
+ return dict(
126
+ permissions=permissions,
127
+ record_ui=record_ui,
128
+ record=record,
129
+ record_uuid=record_uuid,
130
+ )
120
131
 
121
- return dict(permissions={}, record_ui=None, record=None)
132
+ return dict(permissions={}, record_ui=None, record=None, record_uuid=None)
122
133
 
123
134
 
124
135
  def _resolve_record_or_draft_files(record, request):
@@ -163,7 +174,7 @@ def _resolve_record_or_draft_media_files(record, request):
163
174
  return None
164
175
 
165
176
 
166
- def _resolve_checks(record, request, community=None):
177
+ def _resolve_checks(record_uuid, request, community=None):
167
178
  """Resolve the checks for this draft/record related to the community and the request."""
168
179
  # FIXME: Move this logic to invenio-checks
169
180
 
@@ -181,6 +192,10 @@ def _resolve_checks(record, request, community=None):
181
192
  if not is_draft_submission and not is_record_inclusion:
182
193
  return None
183
194
 
195
+ # Early exit if there is no record UUID (for instance for some closed requests)
196
+ if not record_uuid:
197
+ return None
198
+
184
199
  # Resolve the target community from the request if the community was not passed as an argument
185
200
  if not community:
186
201
  community_uuid = request["receiver"]["community"]
@@ -196,15 +211,6 @@ def _resolve_checks(record, request, community=None):
196
211
  communities.append(community_parent_id)
197
212
  communities.append(community.id)
198
213
 
199
- # Resolve the record UUID
200
- record_pid = record["id"]
201
- if is_record_inclusion:
202
- record_uuid = current_rdm_records_service.record_cls.pid.resolve(record_pid).id
203
- else:
204
- record_uuid = current_rdm_records_service.draft_cls.pid.resolve(
205
- record_pid, registered_only=False
206
- ).id
207
-
208
214
  # Early exit if no check config found for the communities
209
215
  from invenio_checks.models import CheckConfig, CheckRun
210
216
 
@@ -253,8 +259,9 @@ def user_dashboard_request_view(request, **kwargs):
253
259
  topic = _resolve_topic_record(request)
254
260
  record_ui = topic["record_ui"]
255
261
  record = topic["record"]
262
+ record_uuid = topic["record_uuid"]
256
263
  is_draft = record_ui["is_draft"] if record_ui else False
257
- checks = _resolve_checks(record_ui, request)
264
+ checks = _resolve_checks(record_uuid, request)
258
265
 
259
266
  files = _resolve_record_or_draft_files(record_ui, request)
260
267
  media_files = _resolve_record_or_draft_media_files(record_ui, request)
@@ -332,8 +339,9 @@ def community_dashboard_request_view(request, community, community_ui, **kwargs)
332
339
  topic = _resolve_topic_record(request)
333
340
  record_ui = topic["record_ui"]
334
341
  record = topic["record"]
342
+ record_uuid = topic["record_uuid"]
335
343
  is_draft = record_ui["is_draft"] if record_ui else False
336
- checks = _resolve_checks(record_ui, request, community)
344
+ checks = _resolve_checks(record_uuid, request, community)
337
345
 
338
346
  permissions.update(topic["permissions"])
339
347
  files = _resolve_record_or_draft_files(record_ui, request)
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
- # Copyright (C) 2019-2024 CERN.
3
+ # Copyright (C) 2019-2025 CERN.
4
4
  # Copyright (C) 2019-2020 Northwestern University.
5
5
  # Copyright (C) 2021 TU Wien.
6
6
  # Copyright (C) 2023-2024 Graz University of Technology.
@@ -19,15 +19,7 @@ from invenio_i18n import lazy_gettext as _
19
19
  from invenio_pages.views import create_page_view
20
20
  from invenio_users_resources.forms import NotificationsForm
21
21
 
22
-
23
- def create_url_rule(rule, default_view_func):
24
- """Generate rule from string or tuple."""
25
- if isinstance(rule, tuple):
26
- path, view_func = rule
27
-
28
- return {"rule": path, "view_func": view_func}
29
- else:
30
- return {"rule": rule, "view_func": default_view_func}
22
+ from invenio_app_rdm.views import create_url_rule
31
23
 
32
24
 
33
25
  #
@@ -0,0 +1,21 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2019-2025 CERN.
4
+ #
5
+ # Invenio App RDM is free software; you can redistribute it and/or modify it
6
+ # under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ """General views and view utilities."""
9
+
10
+
11
+ def create_url_rule(rule, default_view_func):
12
+ """Generate rule from string or tuple."""
13
+ # TODO: We want to deprecate the use of this kind of "string or 2-tuple" config
14
+ # values, and directly use dictionaries that map exactly to the parameters
15
+ # that `Blueprint.add_url_rule(...)` accepts, with some sane defaults.
16
+ if isinstance(rule, tuple):
17
+ path, view_func = rule
18
+
19
+ return {"rule": path, "view_func": view_func}
20
+ else:
21
+ return {"rule": rule, "view_func": default_view_func}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invenio-app-rdm
3
- Version: 13.0.0b2.dev12
3
+ Version: 13.0.0b2.dev14
4
4
  Summary: Invenio Research Data Management.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-app-rdm
6
6
  Author: CERN
@@ -97,6 +97,15 @@ https://inveniordm.docs.cern.ch
97
97
  Changes
98
98
  =======
99
99
 
100
+ Version v13.0.0b2.dev14 (released 2025-04-02)
101
+
102
+ - views: extract `create_url_rule` utility and plan for deprecation
103
+ - communities_ui: make routes + views configurable
104
+
105
+ Version v13.0.0b2.dev13 (released 2025-03-27)
106
+
107
+ - checks: add checks tab to requests (fix record ID retrieval with same logic as record)
108
+
100
109
  Version v13.0.0b2.dev12 (released 2025-03-27)
101
110
 
102
111
  - checks: add checks tab to requests (fix record ID retrieval)
@@ -1,9 +1,10 @@
1
- invenio_app_rdm/__init__.py,sha256=XetAYGL6hzOpgJS2Rwnou7awFxcglRdgtV7Lpxx7Luo,700
1
+ invenio_app_rdm/__init__.py,sha256=bgblKvo6WIigUQCg4pKhZFqNnXFu8bDJ9Layy7cP0-8,700
2
2
  invenio_app_rdm/cli.py,sha256=G6QqNU2W6n6ICtTMnpeKFXIsdorncDmVXwwwsGH5F2k,2746
3
3
  invenio_app_rdm/config.py,sha256=aQHeG7QxiKx01eDi1Xo7hsOfyAfe_yb8SNrq-CDOYag,50448
4
4
  invenio_app_rdm/ext.py,sha256=PkZhATGJDgYqBJQh41NdvBZWR83mgI3Eej6rj10UVJE,5278
5
5
  invenio_app_rdm/tasks.py,sha256=FyrIQXVuPjms-dNEnLrVmmdwrX_IykJ87gcSNgOR6O0,1373
6
6
  invenio_app_rdm/urls.py,sha256=8S95QSs4yS0rtORsd4veo--rF3LSLwZenoowJ5ubbmM,2496
7
+ invenio_app_rdm/views.py,sha256=SDr9NwZEWQcgT_3GFRYdDf6eUaK9DfnoafIkhUf9nSI,785
7
8
  invenio_app_rdm/administration/__init__.py,sha256=8r9LeoE9fNHZSVS5QsCfVhRU7MAiEOWJk9MA3Y--4F8,251
8
9
  invenio_app_rdm/administration/domains/__init__.py,sha256=Qob5kqjRPxpuSE5yDV2tesN6tmaKp5JcxCxGA8Mrcak,487
9
10
  invenio_app_rdm/administration/domains/domains.py,sha256=vafLa-mqkg_tQLjx328E64P_4mksB5kjBlsfunvdatg,5599
@@ -29,7 +30,7 @@ invenio_app_rdm/communities_ui/templates/semantic-ui/invenio_communities/details
29
30
  invenio_app_rdm/communities_ui/templates/semantic-ui/invenio_communities/records/index.html,sha256=5Ub4uyVsjjTHzbhNe8Y-AAZG5oI28wZs2jQXvSPofXw,700
30
31
  invenio_app_rdm/communities_ui/views/__init__.py,sha256=HsbOWjDobxXGx6WFlTn45JYr0V9yqjCpDXOR_i2wmtw,401
31
32
  invenio_app_rdm/communities_ui/views/communities.py,sha256=t7qDZ8CiEwT9lB9B9_nS7IJn3V80t1i-yN48CU9rAyc,6706
32
- invenio_app_rdm/communities_ui/views/ui.py,sha256=QBf1QyaXZ46OqUZXU5CDdg10e2HqCaVnggIpJIdVwok,3154
33
+ invenio_app_rdm/communities_ui/views/ui.py,sha256=7Pk0AqwmNJHRd8wuZEvC17l7tpcxs5xQzsC4aXQzV-o,3009
33
34
  invenio_app_rdm/fixtures/__init__.py,sha256=XwWy4U66FkpWOEBFfn5EnXfuTKlXnh3HWZNBMDX4Rgk,1512
34
35
  invenio_app_rdm/fixtures/oai_sets.py,sha256=ZoS94FNkIsdEJWHihZRYvFAstp3GBrZ0viDml9mQXOI,621
35
36
  invenio_app_rdm/fixtures/pages.py,sha256=R2DaRV__iXQ8Zh-fGcs9g16rUKEDp0xV47iZUfoLIx0,1887
@@ -79,7 +80,7 @@ invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/
79
80
  invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/locations.html,sha256=27-KyPqb05pu-yRXHvxCgZWRSi5bFP6xf7XBn91sbeA,1741
80
81
  invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/stats_popup.html,sha256=5SVzfIS15Aro2Itd2BiaLbMXm0cvvwk6ZCdYjuSwhBw,625
81
82
  invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/version.html,sha256=JpE4e6RpbSR2pQD1rOsfvzD2ur584aRfBWUUap2IMBA,688
82
- invenio_app_rdm/records_ui/views/__init__.py,sha256=4NxQNADuvMsblEsGd3zkKXSNR5_4eLMcFEFYvc6NxVc,5718
83
+ invenio_app_rdm/records_ui/views/__init__.py,sha256=M8eCKOBwsChhQC0alOflXAOl2b-5ke49Bxx6NT7o2vg,5726
83
84
  invenio_app_rdm/records_ui/views/decorators.py,sha256=XUSPpstYyh72IdNaIO4wz3sw1fjI_2DNGsKdUu3ueL4,15769
84
85
  invenio_app_rdm/records_ui/views/deposits.py,sha256=H7LoSmvPzkjVGfhp3TmjMkQkLpJ7jOdmigjVciLqDvA,21536
85
86
  invenio_app_rdm/records_ui/views/filters.py,sha256=Rm55fXJv97cqq8B_6KCe-3PxxHUH4VRu-jd9fTea6r4,6994
@@ -98,10 +99,10 @@ invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/subcommunity/
98
99
  invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/subcommunity-invitation/index.html,sha256=347Saf8Fv78uevCbK2nFiOtNFUT0QyZSZS7lgoNzHdQ,1448
99
100
  invenio_app_rdm/requests_ui/templates/semantic-ui/invenio_requests/user-access-request/index.html,sha256=ltSP9sYPnpmCKMDYpZYU25Wxr3Dfqe2RNDxm6bVjX_I,1779
100
101
  invenio_app_rdm/requests_ui/views/__init__.py,sha256=7QiAyRq8Eu84IXwjzxK63vNeTZnowZ5P85xtw7XgRjs,397
101
- invenio_app_rdm/requests_ui/views/requests.py,sha256=27QPF10j8pgnLmHujnpYuQscF70rI9EKkDuol-F1jE8,15693
102
+ invenio_app_rdm/requests_ui/views/requests.py,sha256=grC2bQWF36xzeftdOSjy_vBWAGSUbupOliPervenF6s,16048
102
103
  invenio_app_rdm/requests_ui/views/ui.py,sha256=DBysYQa__gOCg-pikO6HmoVLmRmMAVWeTBiYhPa7PmA,2359
103
104
  invenio_app_rdm/theme/__init__.py,sha256=QbkxNjjOmGKRlie96HfTXgnFeVQjOX0GdiZnHP7pIhs,277
104
- invenio_app_rdm/theme/views.py,sha256=UJs2_C28BWsXY1JqbRK4_ML1JRtGo1yM2S0_W37JJo4,4545
105
+ invenio_app_rdm/theme/views.py,sha256=sHDaOgCVbBha59S9YK4F68yFo9gg1LdQWyzNzYaEBjo,4312
105
106
  invenio_app_rdm/theme/webpack.py,sha256=5ucwIJQgM1y9EFdRcsxv_ThPs7hXRzdmipVBxoU1McI,5090
106
107
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js,sha256=2-BWDEH3YQPwPt1ey3jUHnMrKTyb0JBPRlydk5_reH8,4151
107
108
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js,sha256=zKROcc3qE64-UhM8ha42K-EDDxAXMupxoocZZ9bjEHo,3452
@@ -524,7 +525,7 @@ invenio_app_rdm/users_ui/views/__init__.py,sha256=SMdY2NJj9GICfr3Xuok7qdNYVtA2bJ
524
525
  invenio_app_rdm/users_ui/views/dashboard.py,sha256=iUn2PrODAwb8ugmMosJKAjPhUzjCiWiAWoXQr9RUFuc,1793
525
526
  invenio_app_rdm/users_ui/views/ui.py,sha256=W_eXM8dLVIrNHQB2UEh37C9BYoHauft6RyvcDNFHovA,1742
526
527
  invenio_app_rdm/utils/files.py,sha256=CruDyO2gDVadSlWEJD-WHpWHeOQ0juh-Ei9jz3D9yjc,3923
527
- invenio_app_rdm-13.0.0b2.dev12.dist-info/licenses/LICENSE,sha256=AZXFHRrZa5s4m9DV7zZr4bPGTMUvcEPCodeV_AmFI8k,1204
528
+ invenio_app_rdm-13.0.0b2.dev14.dist-info/licenses/LICENSE,sha256=AZXFHRrZa5s4m9DV7zZr4bPGTMUvcEPCodeV_AmFI8k,1204
528
529
  tests/__init__.py,sha256=yKVf0yYRuxmXvyAtLjmfpHGVCsEkZOhs_FojAAM_w-8,244
529
530
  tests/conftest.py,sha256=6iR-l-DIpQDxN2LLMu6kbHnLsmAW1m8Lq-j8rNNucf8,8956
530
531
  tests/test_tasks.py,sha256=6l25lcMjL3ZuQr4hsxbAEjSTu_J1aKkOB3ZXqOZZIy0,3712
@@ -557,8 +558,8 @@ tests/ui/test_filters.py,sha256=Q90wsJffjMVir7wNX8taGf2KZleLtPbXZXHLTkBpzLA,284
557
558
  tests/ui/test_signposting_ui.py,sha256=KCSjQlMD2VKlwQCyZYDwYjtVNL35x3u-ZC4ceD5y21w,3847
558
559
  tests/ui/test_static.py,sha256=vO3OQAOhrQESJifnQfM1pw7JYz3J874O8BAb7Cc_PPA,868
559
560
  tests/ui/test_stats_ui.py,sha256=LHa_0hjvpYvliSk_jknWy-90CO82jVElUfK5Ua_ZmfA,3554
560
- invenio_app_rdm-13.0.0b2.dev12.dist-info/METADATA,sha256=R527v3kf8KBH24p6hYLTBVZe7TVEBXN94W2WcW9Dnfc,11959
561
- invenio_app_rdm-13.0.0b2.dev12.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
562
- invenio_app_rdm-13.0.0b2.dev12.dist-info/entry_points.txt,sha256=r1vTqYNABeWqRMWitzyR9FnBsAy-KYZKZCp95IziyLY,2070
563
- invenio_app_rdm-13.0.0b2.dev12.dist-info/top_level.txt,sha256=NqTqrntInEAci7EXcNBvouXFMqwyjVQhEI0b7izYRBY,22
564
- invenio_app_rdm-13.0.0b2.dev12.dist-info/RECORD,,
561
+ invenio_app_rdm-13.0.0b2.dev14.dist-info/METADATA,sha256=CvyWAPM3nrlUqRMNhl3D0m--P-EocQePLD-Q4bLG4wc,12263
562
+ invenio_app_rdm-13.0.0b2.dev14.dist-info/WHEEL,sha256=MAQBAzGbXNI3bUmkDsiV_duv8i-gcdnLzw7cfUFwqhU,109
563
+ invenio_app_rdm-13.0.0b2.dev14.dist-info/entry_points.txt,sha256=r1vTqYNABeWqRMWitzyR9FnBsAy-KYZKZCp95IziyLY,2070
564
+ invenio_app_rdm-13.0.0b2.dev14.dist-info/top_level.txt,sha256=NqTqrntInEAci7EXcNBvouXFMqwyjVQhEI0b7izYRBY,22
565
+ invenio_app_rdm-13.0.0b2.dev14.dist-info/RECORD,,