Commit 46ffe6cb authored by Kostas Papadimitriou's avatar Kostas Papadimitriou
Browse files

Fix astakos stale session messages

Consume session messages in get_services api response. When get_services is
loaded from an astakos page, messages should have already been consumed
in the html response. When get_services is loaded from another
domain/service we consume them in get_services view so that no stale
messages to appear if user visits an astakos view later on.
parent 57872c18
......@@ -40,6 +40,7 @@ from django.utils import simplejson as json
from django.conf import settings
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.contrib import messages
from astakos.im.models import AstakosUser, Service, Resource
from astakos.im.api.faults import (
......@@ -103,6 +104,15 @@ def get_services(request):
data = json.dumps(get_services_dict())
if callback:
# Consume session messages. When get_services is loaded from an astakos
# page, messages should have already been consumed in the html
# response. When get_services is loaded from another domain/service we
# consume them here so that no stale messages to appear if user visits
# an astakos view later on.
# TODO: messages could be served to other services/sites in the dict
# response of get_services and/or get_menu. Services could handle those
# messages respectively.
messages_list = list(messages.get_messages(request))
mimetype = 'application/javascript'
data = '%s(%s)' % (callback, data)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment