Skip to content

Commit

Permalink
Flush the session in get_pk_values()
Browse files Browse the repository at this point in the history
  • Loading branch information
epandurski committed Feb 23, 2019
1 parent c0302b8 commit e32e52d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions flask_signalbus/atomic.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def get_pk_values(cls, instance_or_pk):
"""Return a primary key as a tuple when given any instance or primary key."""

if isinstance(instance_or_pk, cls):
cls._flask_signalbus_sa.session.flush()
instance_or_pk = inspect(cls).primary_key_from_instance(instance_or_pk)
return instance_or_pk if isinstance(instance_or_pk, tuple) else (instance_or_pk,)

Expand Down

0 comments on commit e32e52d

Please sign in to comment.