Skip to content

Commit

Permalink
Update oauth.py
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Fabiani committed Feb 5, 2019
1 parent 01dcc36 commit a108360
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion geonode/base/oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,10 @@ def get_session_token(session):

def get_token_object_from_session(session):
if 'access_token' in session:
return AccessToken.objects.get(token=session['access_token'])
try:
return AccessToken.objects.get(token=str(session['access_token']))
except BaseException:
return None
return None


Expand Down

1 comment on commit a108360

@giohappy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the cast to string shouldn't be required because we always set it as string. Anyway the try / except is a safeguard, that will make the test pass :)

Please sign in to comment.