diff --git a/docs/release-notes.md b/docs/release-notes.md index 0ea76df..4049797 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -1,5 +1,11 @@ # Release Notes +## 0.7.1 + +### Fixed + +- `Lifespan` event on shell returning async manager. + ## 0.7.0 ### Changed diff --git a/saffier/__init__.py b/saffier/__init__.py index 6d2c7c9..53ef95d 100644 --- a/saffier/__init__.py +++ b/saffier/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.7.0" +__version__ = "0.7.1" from saffier.conf import settings from saffier.conf.global_settings import SaffierSettings diff --git a/saffier/migrations/operations/shell/base.py b/saffier/migrations/operations/shell/base.py index fabb9d7..bea1adb 100644 --- a/saffier/migrations/operations/shell/base.py +++ b/saffier/migrations/operations/shell/base.py @@ -35,8 +35,8 @@ def shell(env: MigrationEnv, kernel: bool) -> None: exec(sys.stdin.read(), globals()) return - on_startup = getattr(env.app, "on_startup", None) - on_shutdown = getattr(env.app, "on_shutdown", None) + on_startup = getattr(env.app, "on_startup", []) + on_shutdown = getattr(env.app, "on_shutdown", []) lifespan = getattr(env.app, "lifespan", None) lifespan = handle_lifespan_events( on_startup=on_startup, on_shutdown=on_shutdown, lifespan=lifespan @@ -73,8 +73,6 @@ def handle_lifespan_events( declaration for legacy and comprehension purposes and build the async context manager for the lifespan. """ - if on_startup or on_shutdown: - return AyncLifespanContextManager(on_startup=on_startup, on_shutdown=on_shutdown) - elif lifespan: + if lifespan: return lifespan - return None + return AyncLifespanContextManager(on_startup=on_startup, on_shutdown=on_shutdown)