Skip to content

Commit

Permalink
Fixes #1103
Browse files Browse the repository at this point in the history
  • Loading branch information
oharsta committed Jan 4, 2024
1 parent ced660f commit a2ce548
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions server/db/audit_mixin.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import os

from flask import session, current_app

from sqlalchemy import MetaData
from sqlalchemy import event, inspect
from sqlalchemy.orm import class_mapper
from sqlalchemy.orm import declarative_base
from sqlalchemy.orm import sessionmaker
from sqlalchemy.orm.attributes import get_history

from server.db.db import db
Expand Down Expand Up @@ -142,10 +142,10 @@ def create_audit(connection, subject_id, target, parent_id, parent_name, action,
kwargs.get("state_before"),
kwargs.get("state_after")
)
if connection is None:
db.session.merge(audit)
else:
audit.save(connection)
scoped_session = sessionmaker(db.engine)
with scoped_session.begin() as sc:
sc.merge(audit)
sc.commit()

@classmethod
def __declare_last__(cls):
Expand Down
2 changes: 1 addition & 1 deletion server/requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
APScheduler==3.10.4
mysqlclient==2.2.1
PyYAML==6.0.1
SQLAlchemy==2.0.18
SQLAlchemy==2.0.25
cryptography==41.0.7
flask-jsonschema-validator==0.0.4
flask-mail==0.9.1
Expand Down

0 comments on commit a2ce548

Please sign in to comment.