Skip to content

Commit

Permalink
Check hasattr() first
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Moon committed May 23, 2014
1 parent a15165b commit 37e093c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion oscar/apps/customer/notifications/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

def notifications(request):
ctx = {}
if request.user and request.user.is_authenticated():
if hasattr(request, 'user') and request.user and request.user.is_authenticated():
num_unread = Notification.objects.filter(
recipient=request.user, date_read=None).count()
ctx['num_unread_notifications'] = num_unread
Expand Down

0 comments on commit 37e093c

Please sign in to comment.