First time here? Check out the FAQ!

Revision history  [back]

How does Askbot handle messages in ajax requests?

In the context processors used for Askbot messages, i.e. askbot.user_messages.context_processors.user_messages messages get added to the context using get_and_delete_messages(). As the name foreshadows, this deletes messages from the session/the database.

If there are pending messages and there is an ajax request, for instance a user casts a vote, the context processor is run and the messages get fetched and deleted. I can't tell if the messages get returned with the ajax response, but I think they aren't. This means the messages are lost and won't be shown to the user. Is that correct? Or is there some facility that returns messages to the user and then the javascript on the client side takes care of rendering the messages?

How does Askbot handle messages in ajax requests?

In the context processors used for Askbot messages, i.e. askbot.user_messages.context_processors.user_messages messages get added to the context using get_and_delete_messages(). As the name foreshadows, this deletes messages from the session/the database.

If there are pending messages and there is an ajax request, for instance a user casts a vote, the context processor is run and the messages get fetched and deleted. I can't tell if the messages get returned with the ajax response, but I think they aren't. This means the messages are lost and won't be shown to the user. Is that correct? Or is there some facility that returns messages to the user and then the javascript on the client side takes care of rendering the messages?