First time here? Check out the FAQ!
1

admin logout throw exception

I used the option of make the first user that we create as a admin during askbot installation. But now the problem is I am unable to successfully logout the admin user without exception.

AttributeError at /admin/logout/
'AnonymousUser' object has no attribute 'get_and_delete_messages'
Request Method: GET
Request URL:    http://localhost:8001/admin/logout/
Django Version: 1.4.5
Exception Type: AttributeError
Exception Value:    
'AnonymousUser' object has no attribute 'get_and_delete_messages'
Exception Location: /../askbot/user_messages/context_processors.py in user_messages, line 21
SocialQA's avatar
265
SocialQA
asked 2013-10-29 13:49:57 -0500
Evgeny's avatar
13.2k
Evgeny
updated 2013-10-29 13:59:40 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

2

I solved that problem by modifying /usr/local/lib/python2.7/dist-packages/askbot/user_messages/context_processors.py

# messages = request.user.get_and_delete_messages() .... original, prox. line 22
messages = get_and_delete_messages(request)

Because I find function get_and_delete_messages only defined as a "standalone" function in that file, and never a method of some class. But it is used as request.user.get_and_delete_messages(). I assume it's a typo. If I am right, another typo is in /usr/local/lib/python2.7/dist-packages/askbot/user_messages/__init__.py (same usage).

Correct me if I am wrong. But it's likely my solution works.

hailong's avatar
21
hailong
answered 2013-12-11 10:55:11 -0500
edit flag offensive 0 remove flag delete link

Comments

I tried it and its working fine..

Nikhil's avatar Nikhil (2013-12-11 11:55:22 -0500) edit
add a comment see more comments
1

Do you have line in theMIDDLEWARE_CLASSES in your settings.py?

'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware',

If not, add it, otherwise we may need to look at this issue in more detail.

Evgeny's avatar
13.2k
Evgeny
answered 2013-10-29 13:59:10 -0500
edit flag offensive 0 remove flag delete link

Comments

It would be great if you could look into it in detail. Thanks,

SocialQA's avatar SocialQA (2013-10-29 14:14:26 -0500) edit

I am still seeing the problem do you know if the issue has been fixed?

SocialQA's avatar SocialQA (2013-12-10 09:45:47 -0500) edit
1

'askbot.middleware.anon_user.ConnectToSessionMessagesMiddleware' is there (enabled), but exception occurs

hailong's avatar hailong (2013-12-11 09:09:47 -0500) edit

See my answer under this one. (name: hailong) Since I noticed you are the leading character in this project, I would like ask you to confirm or correct my finding.

hailong's avatar hailong (2013-12-11 10:59:28 -0500) edit
add a comment see more comments