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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
SocialQA's avatar
265
SocialQA
asked 11 years ago
Evgeny's avatar
13.2k
Evgeny
updated 11 years ago

Comments

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
hailong's avatar
21
hailong
answered 11 years ago
link

Comments

I tried it and its working fine..

Nikhil's avatar Nikhil (11 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 11 years ago
link

Comments

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

SocialQA's avatar SocialQA (11 years ago)

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

SocialQA's avatar SocialQA (11 years ago)
1

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

hailong's avatar hailong (11 years ago)

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 (11 years ago)
see more comments