Ask Your Question
1

admin logout throw exception

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

SocialQA gravatar image

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

Evgeny gravatar image

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
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

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

hailong gravatar image

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.

edit flag offensive delete link more

Comments

I tried it and its working fine..

Nikhil gravatar imageNikhil ( 2013-12-11 11:55:22 -0600 )edit
1

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

Evgeny gravatar image

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.

edit flag offensive delete link more

Comments

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

SocialQA gravatar imageSocialQA ( 2013-10-29 14:14:26 -0600 )edit

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

SocialQA gravatar imageSocialQA ( 2013-12-10 09:45:47 -0600 )edit
1

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

hailong gravatar imagehailong ( 2013-12-11 09:09:47 -0600 )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 gravatar imagehailong ( 2013-12-11 10:59:28 -0600 )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

Stats

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

Seen: 220 times

Last updated: Dec 11 '13