diff --git a/migrations/env.py b/migrations/env.py index 74d69a8f..9411efaa 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -22,20 +22,20 @@ def get_engine(): - try: - # this works with Flask-SQLAlchemy<3 and Alchemical - return current_app.extensions['migrate'].db.get_engine() - except TypeError: - # this works with Flask-SQLAlchemy>=3 - return current_app.extensions['migrate'].db.engine - - - def get_engine_url(): - try: - return get_engine().url.render_as_string(hide_password=False).replace( - '%', '%%') - except AttributeError: - return str(get_engine().url).replace('%', '%%') + try: + # this works with Flask-SQLAlchemy<3 and Alchemical + return current_app.extensions['migrate'].db.get_engine() + except TypeError: + # this works with Flask-SQLAlchemy>=3 + return current_app.extensions['migrate'].db.engine + + +def get_engine_url(): + try: + return get_engine().url.render_as_string(hide_password=False).replace( + '%', '%%') + except AttributeError: + return str(get_engine().url).replace('%', '%%') config.set_main_option('sqlalchemy.url', get_engine_url()) target_db = current_app.extensions['migrate'].db diff --git a/poetry.lock b/poetry.lock index a3e2ea16..3560bcff 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2254,6 +2254,22 @@ files = [ {file = "pytz-2022.7.1.tar.gz", hash = "sha256:01a0681c4b9684a28304615eba55d1ab31ae00bf68ec157ec3708a8182dbbcd0"}, ] +[[package]] +name = "pytz-deprecation-shim" +version = "0.1.0.post0" +description = "Shims to make deprecation of pytz easier" +category = "main" +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" +files = [ + {file = "pytz_deprecation_shim-0.1.0.post0-py2.py3-none-any.whl", hash = "sha256:8314c9692a636c8eb3bda879b9f119e350e93223ae83e70e80c31675a0fdc1a6"}, + {file = "pytz_deprecation_shim-0.1.0.post0.tar.gz", hash = "sha256:af097bae1b616dde5c5744441e2ddc69e74dfdcb0c263129610d85b87445a59d"}, +] + +[package.dependencies] +"backports.zoneinfo" = {version = "*", markers = "python_version >= \"3.6\" and python_version < \"3.9\""} +tzdata = {version = "*", markers = "python_version >= \"3.6\""} + [[package]] name = "pyyaml" version = "6.0" @@ -3227,4 +3243,4 @@ testing = ["coverage (>=5.0.3)", "zope.event", "zope.testing"] [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "5fedfd00b18a9385638ca90376a3af274a2304ebe0b738418fbd73cf5da3ad4f" +content-hash = "b9cfe86db5156a3f8c60488dd9eb9cef735614e413972c3318baaf9b3d227fd2" diff --git a/pyproject.toml b/pyproject.toml index 0797a2dd..a28c8973 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -135,6 +135,7 @@ python-dateutil = "^2.8.2" python-gnupg = "^0.5.0" python-ldap = "^3.3.1" python3-saml = "^1.12.0" +pytz-deprecation-shim = "^0.1.0.post0" rcssmin = "^1.0.6" redis = "^4.0.0" regex = "^2023.0.0"