diff options
| author | 2026-07-02 18:34:39 +0200 | |
|---|---|---|
| committer | 2026-07-02 18:34:51 +0200 | |
| commit | fb28c648390464c75ba4903b0e1e0ff2642c8ffb (patch) | |
| tree | 86fa057d26cb07842903aeade09f0fc1bb9614c7 /db/session.py | |
| parent | 4105c3b777e82cb4b6dadf27c109dd21010ad8ce (diff) | |
| download | server-fb28c648390464c75ba4903b0e1e0ff2642c8ffb.tar.gz server-fb28c648390464c75ba4903b0e1e0ff2642c8ffb.tar.bz2 server-fb28c648390464c75ba4903b0e1e0ff2642c8ffb.zip | |
Added users and migrations
Diffstat (limited to 'db/session.py')
| -rw-r--r-- | db/session.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/db/session.py b/db/session.py index 4d83649..ec700bd 100644 --- a/db/session.py +++ b/db/session.py | |||
| @@ -17,5 +17,10 @@ def get_session(): | |||
| 17 | yield session | 17 | yield session |
| 18 | 18 | ||
| 19 | @contextmanager | 19 | @contextmanager |
| 20 | def get_session_context(): | 20 | def get_session_context(autocommit=True): |
| 21 | yield from get_session() | 21 | session = next(get_session()) |
| 22 | |||
| 23 | yield session | ||
| 24 | |||
| 25 | if autocommit: | ||
| 26 | session.commit() | ||
