invenio-app-rdm 13.0.0b3.dev16__py2.py3-none-any.whl → 13.0.0b3.dev17__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.0b3.dev16"
20
+ __version__ = "13.0.0b3.dev17"
21
21
 
22
22
  __all__ = ("__version__",)
@@ -0,0 +1,63 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2025 CERN.
4
+ # Copyright (C) 2025 Northwestern University.
5
+ #
6
+ # Invenio-App-RDM is free software; you can redistribute it and/or modify it
7
+ # under the terms of the MIT License; see LICENSE file for more details.
8
+
9
+ """Community sitemap content."""
10
+
11
+ from invenio_base import invenio_url_for
12
+ from invenio_communities.proxies import current_communities
13
+ from invenio_search.api import RecordsSearchV2
14
+ from invenio_sitemap import SitemapSection, format_to_w3c
15
+
16
+
17
+ class SitemapSectionOfCommunities(SitemapSection):
18
+ """Defines the Sitemap entries for Communities."""
19
+
20
+ def iter_entities(self):
21
+ """Iterate over objects."""
22
+ communities_scan = (
23
+ RecordsSearchV2(index=current_communities.service.record_cls.index._name)
24
+ .filter("term", **{"access.visibility": "public"})
25
+ .filter("term", deletion_status="P")
26
+ .sort("-updated")
27
+ # Using preserve_order is fine.
28
+ # Using Point in Time is a recommended alternative but not
29
+ # particularly better than this one for our needs. See
30
+ # https://opensearch.org/docs/latest/search-plugins/searching-data/point-in-time/
31
+ .params(preserve_order=True)
32
+ # In keeping with original: only page is looked for
33
+ # (curation policy is not most relevant)
34
+ .source(["slug", "updated", "metadata.page"])
35
+ .scan()
36
+ )
37
+
38
+ for community in communities_scan:
39
+ yield {
40
+ "slug": community.slug,
41
+ "updated": community.updated,
42
+ "loc": invenio_url_for(
43
+ "invenio_app_rdm_communities.communities_detail",
44
+ pid_value=community.slug,
45
+ ),
46
+ }
47
+
48
+ if "page" in community.get("metadata", {}):
49
+ yield {
50
+ "slug": community.slug,
51
+ "updated": community.updated,
52
+ "loc": invenio_url_for(
53
+ "invenio_communities.communities_about",
54
+ pid_value=community.slug,
55
+ ),
56
+ }
57
+
58
+ def to_dict(self, entity):
59
+ """To dict used in sitemap."""
60
+ return {
61
+ "loc": entity["loc"],
62
+ "lastmod": format_to_w3c(entity["updated"]),
63
+ }
@@ -9,6 +9,12 @@
9
9
  """Request views module."""
10
10
 
11
11
  from flask import abort, g, redirect, request, url_for
12
+ from invenio_collections.errors import (
13
+ CollectionNotFound,
14
+ CollectionTreeNotFound,
15
+ LogoNotFoundError,
16
+ )
17
+ from invenio_collections.proxies import current_collections
12
18
  from invenio_communities.views.communities import (
13
19
  HEADER_PERMISSIONS,
14
20
  _get_roles_can_invite,
@@ -18,11 +24,6 @@ from invenio_communities.views.communities import (
18
24
  from invenio_communities.views.decorators import pass_community
19
25
  from invenio_pages.proxies import current_pages_service
20
26
  from invenio_pages.records.errors import PageNotFoundError
21
- from invenio_rdm_records.collections import (
22
- CollectionNotFound,
23
- CollectionTreeNotFound,
24
- LogoNotFoundError,
25
- )
26
27
  from invenio_rdm_records.proxies import (
27
28
  current_community_records_service,
28
29
  current_rdm_records,
@@ -54,7 +55,7 @@ def communities_detail(pid_value, community, community_ui):
54
55
  def communities_home(pid_value, community, community_ui):
55
56
  """Community home page."""
56
57
  query_params = request.args
57
- collections_service = current_rdm_records.collections_service
58
+ collections_service = current_collections.service
58
59
  permissions = community.has_permissions_to(HEADER_PERMISSIONS)
59
60
  if not permissions["can_read"]:
60
61
  raise PermissionDeniedError()
@@ -124,7 +125,7 @@ def communities_browse(pid_value, community, community_ui):
124
125
  """Community browse page."""
125
126
  permissions = community.has_permissions_to(HEADER_PERMISSIONS)
126
127
 
127
- collections_service = current_rdm_records.collections_service
128
+ collections_service = current_collections.service
128
129
 
129
130
  trees_ui = collections_service.list_trees(
130
131
  g.identity, community_id=community.id, depth=2
@@ -167,7 +168,7 @@ def community_collection(
167
168
  community, community_ui, pid_value, tree_slug=None, collection_slug=None
168
169
  ):
169
170
  """Render a community collection page."""
170
- collections_service = current_rdm_records.collections_service
171
+ collections_service = current_collections.service
171
172
  try:
172
173
  collection = collections_service.read(
173
174
  identity=g.identity,
@@ -10,6 +10,7 @@
10
10
  """Communities UI blueprints module."""
11
11
 
12
12
  from flask import Blueprint, current_app, request
13
+ from invenio_collections.searchapp import search_app_context as c_search_app_context
13
14
  from invenio_communities.errors import CommunityDeletedError
14
15
  from invenio_communities.views.ui import (
15
16
  not_found_error,
@@ -17,7 +18,6 @@ from invenio_communities.views.ui import (
17
18
  record_tombstone_error,
18
19
  )
19
20
  from invenio_pidstore.errors import PIDDeletedError, PIDDoesNotExistError
20
- from invenio_rdm_records.collections import search_app_context as c_search_app_context
21
21
  from invenio_records_resources.services.errors import (
22
22
  PermissionDeniedError,
23
23
  RecordPermissionDeniedError,
invenio_app_rdm/config.py CHANGED
@@ -167,6 +167,8 @@ from invenio_vocabularies.contrib.subjects.datastreams import (
167
167
  )
168
168
  from werkzeug.local import LocalProxy
169
169
 
170
+ from .communities_ui.sitemap import SitemapSectionOfCommunities
171
+ from .records_ui.sitemap import SitemapSectionOfRDMRecords
170
172
  from .theme.views import notification_settings
171
173
  from .users.schemas import NotificationsUserSchema, UserPreferencesNotificationsSchema
172
174
 
@@ -485,6 +487,10 @@ CELERY_BEAT_SCHEDULE = {
485
487
  "task": "invenio_jobs.logging.tasks.delete_logs",
486
488
  "schedule": crontab(minute=5, hour=0),
487
489
  },
490
+ "update_sitemap": {
491
+ "task": "invenio_sitemap.tasks.update_sitemap_cache",
492
+ "schedule": crontab(minute=0, hour=2),
493
+ },
488
494
  }
489
495
  """Scheduled tasks configuration (aka cronjobs)."""
490
496
 
@@ -1479,3 +1485,11 @@ APP_RDM_SUBCOMMUNITIES_LABEL = "Subcommunities"
1479
1485
 
1480
1486
  RDM_DETAIL_SIDE_BAR_MANAGE_ATTRIBUTES_EXTENSION_TEMPLATE = None
1481
1487
  """Side bar manage attributes extension template."""
1488
+
1489
+ # Invenio-Sitemap
1490
+ # ===============
1491
+ # See https://github.com/inveniosoftware/invenio-sitemap/blob/master/invenio_sitemap/config.py # noqa
1492
+ SITEMAP_SECTIONS = [
1493
+ SitemapSectionOfRDMRecords(),
1494
+ SitemapSectionOfCommunities(),
1495
+ ]
@@ -0,0 +1,44 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2025 CERN.
4
+ # Copyright (C) 2025 Northwestern University.
5
+ #
6
+ # Invenio-App-RDM is free software; you can redistribute it and/or modify it
7
+ # under the terms of the MIT License; see LICENSE file for more details.
8
+
9
+ """RDMRecords sitemap content."""
10
+
11
+ from invenio_base import invenio_url_for
12
+ from invenio_rdm_records.proxies import current_rdm_records_service
13
+ from invenio_search.api import RecordsSearchV2
14
+ from invenio_sitemap import SitemapSection, format_to_w3c
15
+
16
+
17
+ class SitemapSectionOfRDMRecords(SitemapSection):
18
+ """Defines the Sitemap entries for Records."""
19
+
20
+ def iter_entities(self):
21
+ """Iterate over objects."""
22
+ records_scan = (
23
+ RecordsSearchV2(index=current_rdm_records_service.record_cls.index._name)
24
+ .filter("term", **{"access.record": "public"})
25
+ .filter("term", deletion_status="P")
26
+ .sort("-updated")
27
+ # Using preserve_order is fine.
28
+ # Using Point in Time is a recommended alternative but not
29
+ # particularly better than this one for our needs. See
30
+ # https://opensearch.org/docs/latest/search-plugins/searching-data/point-in-time/
31
+ .params(preserve_order=True)
32
+ .source(["id", "updated"])
33
+ .scan()
34
+ )
35
+ return records_scan
36
+
37
+ def to_dict(self, entity):
38
+ """To dict used in sitemap."""
39
+ return {
40
+ "loc": invenio_url_for(
41
+ "invenio_app_rdm_records.record_detail", pid_value=entity["id"]
42
+ ),
43
+ "lastmod": format_to_w3c(entity["updated"]),
44
+ }
@@ -9,3 +9,7 @@ Disallow: /login
9
9
  Disallow: /logout
10
10
  Disallow: /records/*/preview
11
11
  Crawl-delay: 10
12
+
13
+ {%- for url_of_sitemap_index in urls_of_sitemap_indices %}
14
+ Sitemap: {{ url_of_sitemap_index }}
15
+ {%- endfor %}
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2019-2024 CERN.
4
- # Copyright (C) 2019-2020 Northwestern University.
4
+ # Copyright (C) 2019-2025 Northwestern University.
5
5
  # Copyright (C) 2021 TU Wien.
6
6
  # Copyright (C) 2023-2024 Graz University of Technology.
7
7
  # Copyright (C) 2024 KTH Royal Institute of Technology.
@@ -17,6 +17,7 @@ from invenio_db import db
17
17
  from invenio_i18n import get_locale
18
18
  from invenio_i18n import lazy_gettext as _
19
19
  from invenio_pages.views import create_page_view
20
+ from invenio_sitemap import iterate_urls_of_sitemap_indices
20
21
  from invenio_users_resources.forms import NotificationsForm
21
22
 
22
23
  from invenio_app_rdm.views import create_url_rule
@@ -67,7 +68,10 @@ def index():
67
68
 
68
69
  def robots():
69
70
  """Robots.txt."""
70
- return current_app.send_static_file("robots.txt")
71
+ return render_template(
72
+ "invenio_app_rdm/robots.txt",
73
+ urls_of_sitemap_indices=iterate_urls_of_sitemap_indices(),
74
+ )
71
75
 
72
76
 
73
77
  def help_search():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: invenio-app-rdm
3
- Version: 13.0.0b3.dev16
3
+ Version: 13.0.0b3.dev17
4
4
  Summary: Invenio Research Data Management.
5
5
  Home-page: https://github.com/inveniosoftware/invenio-app-rdm
6
6
  Author: CERN
@@ -41,15 +41,17 @@ Requires-Dist: invenio-files-rest<4.0.0,>=3.0.0
41
41
  Requires-Dist: invenio-previewer<4.0.0,>=3.0.0
42
42
  Requires-Dist: invenio-records-files<2.0.0,>=1.2.1
43
43
  Requires-Dist: invenio-communities<19.0.0,>=18.2.0
44
- Requires-Dist: invenio-rdm-records<19.0.0,>=18.4.0
44
+ Requires-Dist: invenio-rdm-records<19.0.0,>=18.14.0
45
45
  Requires-Dist: CairoSVG<3.0.0,>=2.5.2
46
46
  Requires-Dist: invenio-banners<5.0.0,>=4.0.0
47
47
  Requires-Dist: invenio-pages<6.0.0,>=5.0.0
48
48
  Requires-Dist: invenio-audit-logs<1.0.0,>=0.1.0
49
+ Requires-Dist: invenio-sitemap<2.0.0,>=0.1.0
49
50
  Provides-Extra: tests
50
51
  Requires-Dist: pytest-black-ng>=0.4.0; extra == "tests"
51
52
  Requires-Dist: pytest-invenio<4.0.0,>=3.3.0; extra == "tests"
52
53
  Requires-Dist: Sphinx>=4.5.0; extra == "tests"
54
+ Requires-Dist: time-machine<3.0.0,>=2.12.0; extra == "tests"
53
55
  Provides-Extra: elasticsearch7
54
56
  Requires-Dist: invenio-search[elasticsearch7]<4.0.0,>=3.0.0; extra == "elasticsearch7"
55
57
  Provides-Extra: opensearch1
@@ -98,7 +100,12 @@ https://inveniordm.docs.cern.ch
98
100
  Changes
99
101
  =======
100
102
 
101
- Versino v13.0.0b3.dev16 (released 2025-05-23)
103
+ Version v13.0.0b3.dev17 (released 2025-06-02)
104
+
105
+ - Move collections implementaiton to Invenio-Collections
106
+ - Integrate Invenio-Sitemap
107
+
108
+ Version v13.0.0b3.dev16 (released 2025-05-23)
102
109
 
103
110
  - administration: audit_logs: Add View Changes and View Log button and modals
104
111
 
@@ -1,6 +1,6 @@
1
- invenio_app_rdm/__init__.py,sha256=Q0vXNeDts4DzUCAVkBt7DTtlo26Ee6X1SNM8YIFnIfo,700
1
+ invenio_app_rdm/__init__.py,sha256=7C6arZ6LQC300Yd9eTbgAYajvqTJy6q2WjOfntU8RuA,700
2
2
  invenio_app_rdm/cli.py,sha256=G6QqNU2W6n6ICtTMnpeKFXIsdorncDmVXwwwsGH5F2k,2746
3
- invenio_app_rdm/config.py,sha256=xfA5wbNl9L1U-LZXdMCHz509LlvyHinPXAa_YPxDxQM,50880
3
+ invenio_app_rdm/config.py,sha256=F9VyDXDkiSXYtFkixtFUTw4x4AKaYs26HBSuJpJGDdU,51375
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/views.py,sha256=SDr9NwZEWQcgT_3GFRYdDf6eUaK9DfnoafIkhUf9nSI,785
@@ -26,13 +26,14 @@ invenio_app_rdm/administration/views/__init__.py,sha256=2z29bPLUgK4jR_ztgNk4LunT
26
26
  invenio_app_rdm/administration/views/ui.py,sha256=IInmlFgWv6mUfKTHEUfe_czwY6u01j4SYyGMDS2hBsI,543
27
27
  invenio_app_rdm/communities_ui/__init__.py,sha256=7hAwfcQHeSbqIYHyuHqLhJgYXg6NxId4U9NueCQR3uo,325
28
28
  invenio_app_rdm/communities_ui/searchapp.py,sha256=0V_3WNBSf7di1Ml4O4FqlWZ0J9MBLN4F9AtBxF5cQcI,862
29
+ invenio_app_rdm/communities_ui/sitemap.py,sha256=Q7IeUUwd_yi9A7-Q2gcI52vxyN87nVWwDoIbwO-hpTs,2348
29
30
  invenio_app_rdm/communities_ui/templates/semantic-ui/invenio_communities/collections/collection.html,sha256=h4OsqTvZ_qOfa99FKcMf2dH3lQ0VfESVpu7u8A-HHW8,2030
30
31
  invenio_app_rdm/communities_ui/templates/semantic-ui/invenio_communities/collections/macros.html,sha256=a7sVjrW99c_dbGcxc6miSYq8aKvENqXRUgjb6gxN-P4,1824
31
32
  invenio_app_rdm/communities_ui/templates/semantic-ui/invenio_communities/details/browse/index.html,sha256=3cp9pSf1ItKA-PHm2hnmc_x7pIryTFxpxk_yfrgFz3o,2125
32
33
  invenio_app_rdm/communities_ui/templates/semantic-ui/invenio_communities/records/index.html,sha256=5Ub4uyVsjjTHzbhNe8Y-AAZG5oI28wZs2jQXvSPofXw,700
33
34
  invenio_app_rdm/communities_ui/views/__init__.py,sha256=HsbOWjDobxXGx6WFlTn45JYr0V9yqjCpDXOR_i2wmtw,401
34
- invenio_app_rdm/communities_ui/views/communities.py,sha256=t7qDZ8CiEwT9lB9B9_nS7IJn3V80t1i-yN48CU9rAyc,6706
35
- invenio_app_rdm/communities_ui/views/ui.py,sha256=CiwVuk6dqx4sJaT-3nwpo9y-XNLUnO589x9Ln4hXoV8,3009
35
+ invenio_app_rdm/communities_ui/views/communities.py,sha256=21QuhN6m1uWjKrDaxzuZekVQbVetqDQ5Nm2On-tmljQ,6725
36
+ invenio_app_rdm/communities_ui/views/ui.py,sha256=YZ9yiZazEutwkpR4xEolLe6mUtiTJrxVdCOtQGAILOw,3007
36
37
  invenio_app_rdm/fixtures/__init__.py,sha256=XwWy4U66FkpWOEBFfn5EnXfuTKlXnh3HWZNBMDX4Rgk,1512
37
38
  invenio_app_rdm/fixtures/oai_sets.py,sha256=ZoS94FNkIsdEJWHihZRYvFAstp3GBrZ0viDml9mQXOI,621
38
39
  invenio_app_rdm/fixtures/pages.py,sha256=v1ipq8ues_m3y3Y5pSfcIeKNPI5bhwAbUZcpbE_z_ZA,2053
@@ -41,6 +42,7 @@ invenio_app_rdm/fixtures/data/pages.yaml,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
41
42
  invenio_app_rdm/fixtures/pages/.gitkeep,sha256=1HVs32jZTGcMkk-dV9RHGPZm5FdydwFIZDW1epflLF8,68
42
43
  invenio_app_rdm/records_ui/__init__.py,sha256=c4_HH3R7fTOp7AnNQSF4P9h_mwOvL0SE9tkpo6SBnT8,327
43
44
  invenio_app_rdm/records_ui/searchapp.py,sha256=QD5fTdimVUC5K4ERVBjgXHZdbC3ZkgcR8LSIxFTPBQY,2697
45
+ invenio_app_rdm/records_ui/sitemap.py,sha256=erWpwi8lx17ATicBo3dTwMiEEwHTilL8xTAkNCC3J4U,1619
44
46
  invenio_app_rdm/records_ui/utils.py,sha256=0ljPFPC1dAEY_ySZSIT_LRYka2bfsUyvFk_QQAmhYQ4,2687
45
47
  invenio_app_rdm/records_ui/previewer/__init__.py,sha256=T32i_ssGKONDpNB3gECpn20ubHvGYYVrNuIgCADioOM,267
46
48
  invenio_app_rdm/records_ui/previewer/iiif_simple.py,sha256=lGxB3g0hNVJDWnq5jV_KrKPwC-LR1C51DMjas1-UpBM,1589
@@ -104,7 +106,7 @@ invenio_app_rdm/requests_ui/views/__init__.py,sha256=7QiAyRq8Eu84IXwjzxK63vNeTZn
104
106
  invenio_app_rdm/requests_ui/views/requests.py,sha256=Ww3ewDciAvcrheOwtirS6Qewj21FQ8R1b42Og0_r_3w,16149
105
107
  invenio_app_rdm/requests_ui/views/ui.py,sha256=DBysYQa__gOCg-pikO6HmoVLmRmMAVWeTBiYhPa7PmA,2359
106
108
  invenio_app_rdm/theme/__init__.py,sha256=QbkxNjjOmGKRlie96HfTXgnFeVQjOX0GdiZnHP7pIhs,277
107
- invenio_app_rdm/theme/views.py,sha256=Ucn6o7mF8qR7gtOeliKC73gIBhy5LgY65rvteC1Uiog,4312
109
+ invenio_app_rdm/theme/views.py,sha256=mrcxejY9PlYwEqh8f0ojKX4CtmD9jz4f9rU-5aLZszU,4457
108
110
  invenio_app_rdm/theme/webpack.py,sha256=aPWl26SIJApTCN9IESlUwbCXNaUC5yAoGJFSC-omOwk,5247
109
111
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js,sha256=EBda1oklPz8u6cDz5fHU8EeDjUqyNMzOL8Quik-lCks,4592
110
112
  invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js,sha256=oTCQkmr7j6FwVsOfM6hsKrPHfadW7m9IurrqYVDgxDw,3628
@@ -347,7 +349,6 @@ invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/z
347
349
  invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/messages/zh_TW/translations.json,sha256=2-PuJiIAPYQhYFP3pMWEFLAkHGecuT40_Qm33dtm2Xk,9377
348
350
  invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/compileCatalog.js,sha256=O1G3n8drTU_MaMxfHmvwnPXWKbb5-9oSD_vdCocck1I,1216
349
351
  invenio_app_rdm/theme/assets/semantic-ui/translations/invenio_app_rdm/scripts/initCatalog.js,sha256=PKt4RTa29L53rjB_hZnEHahZA4YprWDtWq4nlO7Z0p0,728
350
- invenio_app_rdm/theme/static/robots.txt,sha256=aBc1Jm1Y4Tgbl2oCaK-12akWEkeXexCjSLTjB6yiuHM,205
351
352
  invenio_app_rdm/theme/static/icons/licenses/cc-by-icon.svg,sha256=Aogts2TDR_M090vHNBA2UhEDu79cdTPyjnoNmeDxFII,9719
352
353
  invenio_app_rdm/theme/static/icons/licenses/cc-by-nc-eu-icon.svg,sha256=rJQn1RpDLLHUjVXs3nsxfduzOta1HZ1hBAhtNsvLtcU,15478
353
354
  invenio_app_rdm/theme/static/icons/licenses/cc-by-nc-icon.svg,sha256=65P9CKCvlT-AL8a1mkf1ugPBnQqyBVpDBgiSg20fa8w,15083
@@ -380,6 +381,7 @@ invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/intro_section.html,s
380
381
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/javascript.html,sha256=20O9okaOd_bqpBbuq9K0zqY0UUNXaFVKIslgPArs67U,364
381
382
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/page.html,sha256=zwIZmRWIJpz9UQpEqM3oTaSzlmek6tdP8VDR1Mugka0,951
382
383
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/page_cover.html,sha256=D-NNfCX38wRjHOq1kzPPncKKUd0b9U1al-NMy48dKvU,357
384
+ invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/robots.txt,sha256=KlcyEFTFpgcsDnKNoFTWM2U5uNchvsYJtoS0PsMAG9M,315
383
385
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/searchbar.html,sha256=tvzez_2CE86wl_lipD44MD1swZcZw5uYqXEvvPMkBIo,2222
384
386
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/site_footer.html,sha256=C0xluZe7KCkvRKeeMIt6P8v_EfWyuMCQ_JQvlI0M9Xw,1037
385
387
  invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/files_integrity_report/email/files_integrity_report.html,sha256=mwbLrf2xabxq0dLQzUNWGHeYVoySo9GaaydT-FKC9g8,1237
@@ -477,9 +479,9 @@ invenio_app_rdm/users_ui/views/__init__.py,sha256=SMdY2NJj9GICfr3Xuok7qdNYVtA2bJ
477
479
  invenio_app_rdm/users_ui/views/dashboard.py,sha256=iUn2PrODAwb8ugmMosJKAjPhUzjCiWiAWoXQr9RUFuc,1793
478
480
  invenio_app_rdm/users_ui/views/ui.py,sha256=W_eXM8dLVIrNHQB2UEh37C9BYoHauft6RyvcDNFHovA,1742
479
481
  invenio_app_rdm/utils/files.py,sha256=CruDyO2gDVadSlWEJD-WHpWHeOQ0juh-Ei9jz3D9yjc,3923
480
- invenio_app_rdm-13.0.0b3.dev16.dist-info/licenses/LICENSE,sha256=AZXFHRrZa5s4m9DV7zZr4bPGTMUvcEPCodeV_AmFI8k,1204
482
+ invenio_app_rdm-13.0.0b3.dev17.dist-info/licenses/LICENSE,sha256=AZXFHRrZa5s4m9DV7zZr4bPGTMUvcEPCodeV_AmFI8k,1204
481
483
  tests/__init__.py,sha256=yKVf0yYRuxmXvyAtLjmfpHGVCsEkZOhs_FojAAM_w-8,244
482
- tests/conftest.py,sha256=FQ_aSBxGo0gNfV64RJ117GcmgjVbZKwpxF9_3VNdNJY,7931
484
+ tests/conftest.py,sha256=kxOf2CiULBuE9m-ncNv4AtofUVx7iSnvVljlsdI_iCE,11507
483
485
  tests/test_tasks.py,sha256=YAf2mryFK6Vfzk2053XLBA2e92vbNCTWqJ6ThWhGOuQ,6645
484
486
  tests/test_utils.py,sha256=nvj59DibjRZgLzwnch83tyCw9R1DEuDSQhU7v7mEOT0,1897
485
487
  tests/test_version.py,sha256=c_ayM-WLlD0Q6z939sBnFpMTY160TmFg-9-hGsPa7FE,410
@@ -503,16 +505,17 @@ tests/redirector/__init__.py,sha256=yKVf0yYRuxmXvyAtLjmfpHGVCsEkZOhs_FojAAM_w-8,
503
505
  tests/redirector/conftest.py,sha256=KAbp0R8tgGoNvMr8mJ1G2AZX6PzLw-PChtbucrLn5_o,1676
504
506
  tests/redirector/test_redirector.py,sha256=iATYglIw3QSoUKpspQCAM4SaG_WmzjL7r1Nmew_KlGY,1002
505
507
  tests/ui/__init__.py,sha256=yKVf0yYRuxmXvyAtLjmfpHGVCsEkZOhs_FojAAM_w-8,244
506
- tests/ui/conftest.py,sha256=3Msw0lfBoboQ7X-oZv_wGN7UF6StUpHPRVzRvbjhpoI,3472
508
+ tests/ui/conftest.py,sha256=Yx6_wQtAaPG3dll4UtxxN37nEr87Y_8kos8TzrijHbw,3380
507
509
  tests/ui/test_deposits.py,sha256=BehQzo1r3_f4Uc9jcXRddd9bS5GfQ3jRRYOM0AMbi3w,3792
508
510
  tests/ui/test_export_formats.py,sha256=pCXJCTp9ykEWb2oB-ynGjQDhFaVsOs31ym0stwfWCaQ,909
509
511
  tests/ui/test_file_download.py,sha256=o4JHkFyJxZDaQ5NHRZR_PV98jS9UtklbOZPpduzwWKw,2436
510
512
  tests/ui/test_filters.py,sha256=Q90wsJffjMVir7wNX8taGf2KZleLtPbXZXHLTkBpzLA,284
513
+ tests/ui/test_robotstxt.py,sha256=Gn0bVPJTDRQH6DO5GGZyD6iMel1UxWRHP5MnGQZ0j18,1138
511
514
  tests/ui/test_signposting_ui.py,sha256=KCSjQlMD2VKlwQCyZYDwYjtVNL35x3u-ZC4ceD5y21w,3847
512
- tests/ui/test_static.py,sha256=vO3OQAOhrQESJifnQfM1pw7JYz3J874O8BAb7Cc_PPA,868
515
+ tests/ui/test_sitemaps.py,sha256=hPeGbo9v5Q55swr-ZyudAVYm7aJ6lCKV51Vtupk450Q,3180
513
516
  tests/ui/test_stats_ui.py,sha256=LHa_0hjvpYvliSk_jknWy-90CO82jVElUfK5Ua_ZmfA,3554
514
- invenio_app_rdm-13.0.0b3.dev16.dist-info/METADATA,sha256=GPwRcGyrnNnAk7WI6gYPFpXqf-JAehp4aYogAtzKmsY,14216
515
- invenio_app_rdm-13.0.0b3.dev16.dist-info/WHEEL,sha256=egKm5cKfE6OqlHwodY8Jjp4yqZDBXgsj09UsV5ojd_U,109
516
- invenio_app_rdm-13.0.0b3.dev16.dist-info/entry_points.txt,sha256=rfzEeOEdtGy99NlpWzeW-32CoO5XrEpBvlZwLD2Th88,2158
517
- invenio_app_rdm-13.0.0b3.dev16.dist-info/top_level.txt,sha256=NqTqrntInEAci7EXcNBvouXFMqwyjVQhEI0b7izYRBY,22
518
- invenio_app_rdm-13.0.0b3.dev16.dist-info/RECORD,,
517
+ invenio_app_rdm-13.0.0b3.dev17.dist-info/METADATA,sha256=zVUvzrmTnfyjKeud1ylzuoeclZB0Y6EzOHxZyU8kUPg,14456
518
+ invenio_app_rdm-13.0.0b3.dev17.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
519
+ invenio_app_rdm-13.0.0b3.dev17.dist-info/entry_points.txt,sha256=rfzEeOEdtGy99NlpWzeW-32CoO5XrEpBvlZwLD2Th88,2158
520
+ invenio_app_rdm-13.0.0b3.dev17.dist-info/top_level.txt,sha256=NqTqrntInEAci7EXcNBvouXFMqwyjVQhEI0b7izYRBY,22
521
+ invenio_app_rdm-13.0.0b3.dev17.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.8.0)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any
tests/conftest.py CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  #
3
3
  # Copyright (C) 2019-2025 CERN.
4
- # Copyright (C) 2019-2021 Northwestern University.
4
+ # Copyright (C) 2019-2025 Northwestern University.
5
5
  # Copyright (C) 2024-2025 Graz University of Technology.
6
6
  #
7
7
  # Invenio App RDM is free software; you can redistribute it and/or modify it
@@ -9,6 +9,9 @@
9
9
 
10
10
  """Common pytest fixtures and plugins."""
11
11
 
12
+ import copy
13
+ from collections import namedtuple
14
+
12
15
  # Monkey patch Werkzeug 2.1
13
16
  # Flask-Login uses the safe_str_cmp method which has been removed in Werkzeug
14
17
  # 2.1. Flask-Login v0.6.0 (yet to be released at the time of writing) fixes the
@@ -27,8 +30,6 @@ except AttributeError:
27
30
 
28
31
  security.safe_str_cmp = hmac.compare_digest
29
32
 
30
- from collections import namedtuple
31
-
32
33
  import pytest
33
34
  from flask_security import login_user
34
35
  from flask_security.utils import hash_password
@@ -67,6 +68,12 @@ def subjects_service(app):
67
68
  return current_service_registry.get("subjects")
68
69
 
69
70
 
71
+ @pytest.fixture(scope="module")
72
+ def records_service(app):
73
+ """Records service."""
74
+ return current_service_registry.get("records")
75
+
76
+
70
77
  pytest_plugins = ("celery.contrib.pytest",)
71
78
 
72
79
 
@@ -168,10 +175,16 @@ def client_with_login(client, users):
168
175
  return client
169
176
 
170
177
 
178
+ def create_vocabulary_type(id_, pid_type):
179
+ """Create vocabulary type."""
180
+ vocabulary_service = current_service_registry.get("vocabularies")
181
+ return vocabulary_service.create_type(system_identity, id_, pid_type)
182
+
183
+
171
184
  @pytest.fixture(scope="module")
172
185
  def resource_type_type(app):
173
186
  """Resource type vocabulary type."""
174
- return vocabulary_service.create_type(system_identity, "resourcetypes", "rsrct")
187
+ return create_vocabulary_type("resourcetypes", "rsrct")
175
188
 
176
189
 
177
190
  @pytest.fixture(scope="module")
@@ -207,7 +220,7 @@ def resource_type_item(app, resource_type_type):
207
220
  @pytest.fixture(scope="module")
208
221
  def languages_type(app):
209
222
  """Language vocabulary type."""
210
- return vocabulary_service.create_type(system_identity, "languages", "lng")
223
+ return create_vocabulary_type("languages", "lng")
211
224
 
212
225
 
213
226
  @pytest.fixture(scope="module")
@@ -260,13 +273,118 @@ def subject_item(app, subjects_mesh_scheme, subjects_service):
260
273
  return subj
261
274
 
262
275
 
276
+ @pytest.fixture(scope="module")
277
+ def communitytypes_type(app):
278
+ """Creates and retrieves a vocabulary type."""
279
+ return create_vocabulary_type("communitytypes", "comtyp")
280
+
281
+
282
+ @pytest.fixture(scope="module")
283
+ def communitytypes(communitytypes_type):
284
+ """Community types."""
285
+ vocabulary_service = current_service_registry.get("vocabularies")
286
+ type_dicts = [
287
+ {"id": "organization", "title": {"en": "Organization"}},
288
+ {"id": "event", "title": {"en": "Event"}},
289
+ {"id": "topic", "title": {"en": "Topic"}},
290
+ {"id": "project", "title": {"en": "Project"}},
291
+ ]
292
+ [t.update({"type": "communitytypes"}) for t in type_dicts]
293
+ types = [
294
+ vocabulary_service.create(identity=system_identity, data=t) for t in type_dicts
295
+ ]
296
+ vocabulary_service.indexer.refresh()
297
+ return types
298
+
299
+
300
+ @pytest.fixture()
301
+ def community_input():
302
+ """Community input dict."""
303
+ return {
304
+ "access": {
305
+ "visibility": "public",
306
+ "member_policy": "open",
307
+ "record_policy": "open",
308
+ },
309
+ "slug": "my_community_id",
310
+ "metadata": {
311
+ "title": "My Community",
312
+ # "description": "This is an example Community.",
313
+ "type": {"id": "event"},
314
+ # "curation_policy": "This is the kind of records we accept.",
315
+ # "website": "https://inveniosoftware.org/",
316
+ },
317
+ }
318
+
319
+
263
320
  RunningApp = namedtuple(
264
321
  "RunningApp",
265
- ["app", "location", "resource_type_item", "language_item", "subject_item"],
322
+ [
323
+ "app",
324
+ "location",
325
+ "resource_type_item",
326
+ "language_item",
327
+ "subject_item",
328
+ "communitytypes",
329
+ ],
266
330
  )
267
331
 
268
332
 
269
333
  @pytest.fixture
270
- def running_app(app, location, resource_type_item, language_item, subject_item):
334
+ def running_app(
335
+ app, location, resource_type_item, language_item, subject_item, communitytypes
336
+ ):
271
337
  """Fixture mimicking a running app."""
272
- return RunningApp(app, location, resource_type_item, language_item, subject_item)
338
+ return RunningApp(
339
+ app, location, resource_type_item, language_item, subject_item, communitytypes
340
+ )
341
+
342
+
343
+ @pytest.fixture()
344
+ def create_record(running_app, minimal_record, records_service):
345
+ """Record creation and publication function fixture."""
346
+ files_service = records_service.draft_files
347
+
348
+ def _create_record(identity=None, data=minimal_record, files=None):
349
+ """Create and publish an RDMRecord.
350
+
351
+ Optionally assign it files.
352
+ """
353
+ idty = identity or system_identity
354
+ data_copy = copy.deepcopy(data)
355
+ if files:
356
+ data_copy["files"] = {"enabled": True}
357
+
358
+ draft_data = records_service.create(idty, data_copy)._record
359
+ pid_value_of_draft = draft_data.pid.pid_value
360
+ if files:
361
+ files_service.init_files(idty, pid_value_of_draft, [f.data for f in files])
362
+ for f in files:
363
+ files_service.set_file_content(
364
+ idty,
365
+ id_=pid_value_of_draft,
366
+ file_key=f.data["key"],
367
+ stream=f.content,
368
+ content_length=f.content.getbuffer().nbytes,
369
+ )
370
+ files_service.commit_file(
371
+ idty, id_=pid_value_of_draft, file_key=f.data["key"]
372
+ )
373
+
374
+ record_result = records_service.publish(idty, id_=pid_value_of_draft)
375
+ return record_result
376
+
377
+ return _create_record
378
+
379
+
380
+ @pytest.fixture()
381
+ def create_community(running_app, community_input):
382
+ """Community creation function fixture."""
383
+ community_service = current_service_registry.get("communities")
384
+
385
+ def _create_community(identity=None, data=community_input):
386
+ """Create a community."""
387
+ idty = identity or system_identity
388
+ return community_service.create(idty, data)
389
+
390
+ return _create_community
tests/ui/conftest.py CHANGED
@@ -20,7 +20,7 @@ from flask_webpackext.manifest import (
20
20
  )
21
21
  from invenio_access.permissions import any_user, authenticated_user, system_identity
22
22
  from invenio_app.factory import create_ui
23
- from invenio_rdm_records.proxies import current_rdm_records
23
+ from invenio_rdm_records.proxies import current_rdm_records_service
24
24
  from invenio_search import current_search
25
25
 
26
26
 
@@ -67,11 +67,9 @@ def index_templates(running_app):
67
67
 
68
68
 
69
69
  @pytest.fixture()
70
- def record(running_app, minimal_record):
70
+ def record(running_app, minimal_record, create_record):
71
71
  """Create and publish a record."""
72
- s = current_rdm_records.records_service
73
- draft = s.create(system_identity, minimal_record)
74
- return s.publish(system_identity, draft.id)
72
+ return create_record(data=minimal_record)
75
73
 
76
74
 
77
75
  @pytest.fixture()
@@ -83,7 +81,7 @@ def draft_with_file(running_app, minimal_record, users):
83
81
  user_identity = Identity(users["user1"].id)
84
82
  user_identity.provides.add(any_user)
85
83
  user_identity.provides.add(authenticated_user)
86
- record_service = current_rdm_records.records_service
84
+ record_service = current_rdm_records_service
87
85
  file_service = record_service.draft_files
88
86
 
89
87
  draft = record_service.create(user_identity, minimal_record)
@@ -95,7 +93,7 @@ def draft_with_file(running_app, minimal_record, users):
95
93
  "metadata": {
96
94
  "description": "Published article PDF.",
97
95
  },
98
- }
96
+ },
99
97
  ]
100
98
  file_service.init_files(system_identity, draft.id, file_to_initialise)
101
99
  content = BytesIO(b"test file content")
@@ -113,5 +111,5 @@ def draft_with_file(running_app, minimal_record, users):
113
111
  @pytest.fixture()
114
112
  def record_with_file(draft_with_file):
115
113
  """Create and publish a record with file."""
116
- record_service = current_rdm_records.records_service
114
+ record_service = current_rdm_records_service
117
115
  return record_service.publish(system_identity, draft_with_file.id)
@@ -0,0 +1,35 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2022 CERN.
4
+ # Copyright (C) 2025 Northwestern University.
5
+ #
6
+ # Invenio-RDM is free software; you can redistribute it and/or modify
7
+ # it under the terms of the MIT License; see LICENSE file for more details.
8
+
9
+ import pytest
10
+ from invenio_cache import current_cache
11
+ from invenio_sitemap import SitemapIndexCache
12
+
13
+
14
+ @pytest.fixture
15
+ def cache_for_sitemap_index(app):
16
+ """Primed cache with a sitemap index entry."""
17
+ try:
18
+ cache = SitemapIndexCache(current_cache)
19
+ cache.delete_included_and_higher(0)
20
+ cache.set(0, "unimportant data")
21
+ yield cache
22
+ finally:
23
+ cache.delete_included_and_higher(0)
24
+
25
+
26
+ def test_robotstxt(app, client, cache_for_sitemap_index):
27
+ """Check if robots.txt returns a string response."""
28
+ response = client.get("/robots.txt")
29
+
30
+ assert 200 == response.status_code
31
+ assert type(response.text) == str
32
+ assert "Disallow: /search" in response.text
33
+ assert "Disallow: /api" in response.text
34
+ assert "Disallow: /administration" in response.text
35
+ assert "Sitemap: https://127.0.0.1:5000/sitemap_index_0.xml" in response.text
@@ -0,0 +1,85 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2025 Northwestern University.
4
+ #
5
+ # Invenio-App-RDM is free software; you can redistribute it and/or modify
6
+ # it under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ """Test sitemaps."""
9
+
10
+ import datetime
11
+
12
+ import time_machine
13
+ from invenio_communities.proxies import current_communities
14
+
15
+ from invenio_app_rdm.communities_ui.sitemap import SitemapSectionOfCommunities
16
+ from invenio_app_rdm.records_ui.sitemap import SitemapSectionOfRDMRecords
17
+
18
+
19
+ def test_sitemap_section_of_communities(running_app, community_input, create_community):
20
+ # by default converted to UTC w/ time 00:00:00
21
+ with time_machine.travel(datetime.date(2025, 3, 27)):
22
+ community_input["slug"] = "my-test-community-1"
23
+ c1 = create_community(data=community_input)
24
+ community_input["slug"] = "my-test-community-2"
25
+ community_input["access"]["visibility"] = "restricted"
26
+ c2 = create_community(data=community_input)
27
+ with time_machine.travel(datetime.date(2025, 3, 28)):
28
+ community_input["slug"] = "my-test-community-3"
29
+ community_input["access"]["visibility"] = "public"
30
+ community_input["metadata"]["page"] = "A page to be indexed."
31
+ c3 = create_community(data=community_input)
32
+
33
+ current_communities.service.indexer.refresh() # index in search engine
34
+ section = SitemapSectionOfCommunities()
35
+
36
+ entries = [section.to_dict(entity) for entity in section.iter_entities()]
37
+
38
+ expected_entries = [
39
+ {
40
+ "loc": "https://127.0.0.1:5000/communities/my-test-community-3/records",
41
+ "lastmod": "2025-03-28T00:00:00Z",
42
+ },
43
+ {
44
+ "loc": "https://127.0.0.1:5000/communities/my-test-community-3/about",
45
+ "lastmod": "2025-03-28T00:00:00Z",
46
+ },
47
+ {
48
+ "loc": "https://127.0.0.1:5000/communities/my-test-community-1/records",
49
+ "lastmod": "2025-03-27T00:00:00Z",
50
+ },
51
+ ]
52
+ assert expected_entries == entries
53
+
54
+
55
+ def test_sitemap_section_of_records(
56
+ running_app, minimal_record, create_record, records_service
57
+ ):
58
+ # by default converted to UTC w/ time 00:00:00
59
+ with time_machine.travel(datetime.date(2025, 3, 27)):
60
+ minimal_record["title"] = "my-test-record-1"
61
+ r1 = create_record(data=minimal_record)
62
+ minimal_record["title"] = "my-test-record-2"
63
+ minimal_record["access"]["record"] = "restricted"
64
+ r2 = create_record(data=minimal_record)
65
+ with time_machine.travel(datetime.date(2025, 3, 28)):
66
+ minimal_record["title"] = "my-test-record-3"
67
+ minimal_record["access"]["record"] = "public"
68
+ r3 = create_record(data=minimal_record)
69
+
70
+ records_service.indexer.refresh()
71
+ section = SitemapSectionOfRDMRecords()
72
+
73
+ entries = [section.to_dict(entity) for entity in section.iter_entities()]
74
+
75
+ expected_entries = [
76
+ {
77
+ "loc": f"https://127.0.0.1:5000/records/{r3.id}",
78
+ "lastmod": "2025-03-28T00:00:00Z",
79
+ },
80
+ {
81
+ "loc": f"https://127.0.0.1:5000/records/{r1.id}",
82
+ "lastmod": "2025-03-27T00:00:00Z",
83
+ },
84
+ ]
85
+ assert expected_entries == entries
tests/ui/test_static.py DELETED
@@ -1,25 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2022 CERN.
4
- #
5
- # Invenio-RDM is free software; you can redistribute it and/or modify
6
- # it under the terms of the MIT License; see LICENSE file for more details.
7
-
8
-
9
- def test_static(app, client, es_clear):
10
- """Check if robots.txt returns a string response."""
11
-
12
- # Save the current static folder to revert after finishing the test.
13
- app_static_folder = app.static_folder
14
- # Use as static folder the one of the blueprint we are testing.
15
- app.static_folder = app.blueprints["invenio_app_rdm"].static_folder
16
-
17
- response = client.get("/robots.txt")
18
-
19
- assert response.status_code == 200
20
- assert type(response.text) == str
21
- assert "Disallow: /search" in response.text
22
- assert "Disallow: /api" in response.text
23
- assert "Disallow: /administration" in response.text
24
-
25
- app.static_folder = app_static_folder