Ask Your Question

admin logout throw exception

asked 2013-10-29 13:49:57 -0500

SocialQA's avatar

updated 2013-10-29 13:59:40 -0500

Evgeny's avatar

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/ in user_messages, line 21
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2013-12-11 10:55:11 -0500

hailong's avatar

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

# 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/ (same usage).

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

edit flag offensive delete link more


I tried it and its working fine..

Nikhil's avatar Nikhil  ( 2013-12-11 11:55:22 -0500 )edit

answered 2013-10-29 13:59:10 -0500

Evgeny's avatar

Do you have line in theMIDDLEWARE_CLASSES in your


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

edit flag offensive delete link more


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

'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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2013-10-29 13:49:57 -0500

Seen: 348 times

Last updated: Dec 11 '13