From 2a09a44b2b18451829b1d171ab9c2589ecaadccc Mon Sep 17 00:00:00 2001 From: alex Date: Mon, 16 Dec 2024 11:30:51 +0100 Subject: [PATCH] fix url template Changes: - fix incorrect inclusion of db password for hashing (netloc worked unexpectly) - fix missing inclusion of database --- edgy/cli/templates/url/script.py.mako | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/edgy/cli/templates/url/script.py.mako b/edgy/cli/templates/url/script.py.mako index d0bc9d1f..eb2bd8cf 100644 --- a/edgy/cli/templates/url/script.py.mako +++ b/edgy/cli/templates/url/script.py.mako @@ -30,7 +30,7 @@ ${hash_to_identifier_as_string} def upgrade(url: Optional[DatabaseURL] = None) -> None: - urlstring = "" if url is None else f"{url.username}:{url.netloc}" + urlstring = "" if url is None else f"{url.username}@{url.hostname}:{url.port}/{url.database}" # hash_to_identifier adds already an "_" fn = globals().get(f"upgrade{hash_to_identifier(urlstring)}") if fn is not None: @@ -38,7 +38,7 @@ def upgrade(url: Optional[DatabaseURL] = None) -> None: def downgrade(url: Optional[DatabaseURL] = None) -> None: - urlstring = "" if url is None else f"{url.username}:{url.netloc}" + urlstring = "" if url is None else f"{url.username}@{url.hostname}:{url.port}/{url.database}" # hash_to_identifier adds already an "_" fn = globals().get(f"downgrade{hash_to_identifier(urlstring)}") if fn is not None: @@ -55,7 +55,7 @@ def downgrade(url: Optional[DatabaseURL] = None) -> None: url = monkay.instance.registry.extra[name].url else: url = monkay.instance.registry.database.url - return f"{url.username}:{url.netloc}" + return f"{url.username}@{url.hostname}:{url.port}/{url.database}" %> ## generate an "upgrade_() / downgrade_()" function