refac: get_db_context
This commit is contained in:
1 parent
614cb56420
commit
2bb13d5dbc
1 file changed
+1
-1
@@ -164,7 +164,7 @@ get_db = contextmanager(get_session)
|
||||
|
||||
@contextmanager
|
||||
def get_db_context(db: Optional[Session] = None):
|
||||
if db:
|
||||
if isinstance(db, Session):
|
||||
yield db
|
||||
else:
|
||||
with get_db() as session:
|
||||
|
||||
Reference in new issue
Block a user