Skip to content

Commit

Permalink
check for session is None with getattr()
Browse files Browse the repository at this point in the history
  • Loading branch information
khpeterson committed Aug 24, 2019
1 parent 72fe925 commit e8312a4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions hijack/templatetags/hijack_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _render_hijack_notification(request, template_name=None):
else:
template_name = 'hijack/notifications.html'
ans = ''
if request is not None and request.session is not None and all([
if request is not None and getattr(request, "session", None) is not None and all([
hijack_settings.HIJACK_DISPLAY_WARNING,
request.session.get('is_hijacked_user', False),
request.session.get('display_hijack_warning', False),
Expand All @@ -52,7 +52,7 @@ def can_hijack(hijacker, hijacked):
@register.filter
def is_hijacked(request):
return (request is not None and
request.session is not None and
getattr(request, "session", None) is not None and
request.session.get('is_hijacked_user', False))

try:
Expand Down

0 comments on commit e8312a4

Please sign in to comment.