Commit fae79181 authored by Christos Stavrakakis's avatar Christos Stavrakakis

astakos: check that request.user is a 'User'

Update astakos 'get_menu' API method, to check if request.user is an
instance of django User model. This view function called by astakos
context processor. However, if astakos and helpdesk are installed
together, the request.user will not hold an AnonymousUser, but a
dictionary. This issue caused some weird logs when running tests.
parent 961181ec
......@@ -42,6 +42,7 @@ from django.utils import simplejson as json
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.contrib.auth.models import User
from snf_django.lib import api
from astakos.im.models import Service
......@@ -84,7 +85,7 @@ def get_menu(request, with_extra_links=False, with_signout=True):
user = request.user
index_url = reverse('index')
if user.is_authenticated():
if isinstance(user, User) and user.is_authenticated():
l = []
append = l.append
item = MenuItem
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment