Skip to content

Commit

Permalink
Fixes ponyorm#432: flask can trigger teardown_request without real re…
Browse files Browse the repository at this point in the history
…quest.
  • Loading branch information
sashaaero authored and kozlovsky committed Mar 24, 2019
1 parent 0b9667b commit 5618cce
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pony/flask/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ def _enter_session():

def _exit_session(exception):
session = getattr(request, 'pony_session', None)
if session is None:
raise RuntimeError('Request object lost db_session')
session.__exit__(exc=exception)
if session is not None:
session.__exit__(exc=exception)

class Pony(object):
def __init__(self, app=None):
Expand Down

0 comments on commit 5618cce

Please sign in to comment.