diff --git a/invenio_config_tuw/notifications/backends.py b/invenio_config_tuw/notifications/backends.py index dd7d937d35bef435a9e33e455091004b4366803b..1b858875902518436baf149f2d8888fe327b3f90 100644 --- a/invenio_config_tuw/notifications/backends.py +++ b/invenio_config_tuw/notifications/backends.py @@ -29,7 +29,7 @@ def temp_hack_notification_type(notification): notification, "template_name", notification.context.get("template_name", None) ) if temp_type: - notification.type = temp_type.rstrip(".jinja") + notification.type = temp_type.removesuffix(".jinja") yield notification notification.type = old_notif_type diff --git a/invenio_config_tuw/startup/config.py b/invenio_config_tuw/startup/config.py index 2ed303aefc47e839d8342f929ef0887b647bb69c..e5f3f623a08cc02bf98bb4a87a77e7f9f6486392 100644 --- a/invenio_config_tuw/startup/config.py +++ b/invenio_config_tuw/startup/config.py @@ -81,7 +81,7 @@ def _make_site_url(suffix): url = current_app.config.get("THEME_SITEURL", "") # do a little dance to make sure there's no extra slashes - return (url.rstrip("/") + "/" + suffix.lstrip("/")).rstrip("/") + return (url.removesuffix("/") + "/" + suffix.removeprefix("/")).removesuffix("/") def assemble_db_uri_from_parts(app): @@ -186,7 +186,9 @@ def assemble_site_urls_from_parts(app): theme_siteurl = theme_siteurl or f"{preferred_scheme}://{server_name}" elif theme_siteurl: - server_name = theme_siteurl.lstrip("http://").lstrip("https://").split("/")[0] + server_name = ( + theme_siteurl.removeprefix("http://").removeprefix("https://").split("/")[0] + ) app.logger.info( f"No SERVER_NAME set, calculated value '{server_name}' from THEME_SITEURL: '{theme_siteurl}'" )