Skip to content

Commit

Permalink
Try to discern what the session is without expecting the user to pass…
Browse files Browse the repository at this point in the history
… it.
  • Loading branch information
Fiveside committed Apr 19, 2014
1 parent 47ddd7c commit 6761553
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion shield/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import operator
from six.moves import map, reduce
from ._registry import registry
from sqlalchemy.orm import object_session
import functools


Expand All @@ -16,7 +17,7 @@ def filter_(*permissions, **kwargs):
berarer or target.
"""
bearer = kwargs['bearer']
session = kwargs['session']
session = kwargs.get('session', object_session(bearer))
target = kwargs.get('target')

query = session.query(target)
Expand Down

0 comments on commit 6761553

Please sign in to comment.