*** Wartungsfenster jeden ersten Mittwoch vormittag im Monat ***

Skip to content
Snippets Groups Projects
Commit c5a7315c authored by Moser, Maximilian's avatar Moser, Maximilian
Browse files

Fix incorrect usage of `lstrip()` and `rstrip()`

* what we actually want to do is `removeprefix()` and `removesuffix()`
parent 31ae27b5
Branches
Tags
1 merge request!90Send notification about started review to other reviewers
...@@ -29,7 +29,7 @@ def temp_hack_notification_type(notification): ...@@ -29,7 +29,7 @@ def temp_hack_notification_type(notification):
notification, "template_name", notification.context.get("template_name", None) notification, "template_name", notification.context.get("template_name", None)
) )
if temp_type: if temp_type:
notification.type = temp_type.rstrip(".jinja") notification.type = temp_type.removesuffix(".jinja")
yield notification yield notification
notification.type = old_notif_type notification.type = old_notif_type
......
...@@ -81,7 +81,7 @@ def _make_site_url(suffix): ...@@ -81,7 +81,7 @@ def _make_site_url(suffix):
url = current_app.config.get("THEME_SITEURL", "") url = current_app.config.get("THEME_SITEURL", "")
# do a little dance to make sure there's no extra slashes # 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): def assemble_db_uri_from_parts(app):
...@@ -186,7 +186,9 @@ def assemble_site_urls_from_parts(app): ...@@ -186,7 +186,9 @@ def assemble_site_urls_from_parts(app):
theme_siteurl = theme_siteurl or f"{preferred_scheme}://{server_name}" theme_siteurl = theme_siteurl or f"{preferred_scheme}://{server_name}"
elif theme_siteurl: 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( app.logger.info(
f"No SERVER_NAME set, calculated value '{server_name}' from THEME_SITEURL: '{theme_siteurl}'" f"No SERVER_NAME set, calculated value '{server_name}' from THEME_SITEURL: '{theme_siteurl}'"
) )
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment