Mercurial > libervia-web
view src/server/session_iface.py @ 957:67bf14c91d5c
server (pages): added a confirm flag on successful post:
A new set is used in SATSession to keep flags.
First flag is "confirm": it is set when some data have been posted (so a confirmation message can be displayed in template).
If seen in session, the template "confirm" variable is set to True, and the flag is removed from session (a refresh of the page will not display the confirm message anymore).
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 11 Jul 2017 07:46:20 +0200 |
parents | dabecab10faa |
children | e59edcae4c18 |
line wrap: on
line source
#!/usr/bin/python # -*- coding: utf-8 -*- # Libervia: a SAT frontend # Copyright (C) 2009-2016 Jérôme Poisson (goffi@goffi.org) # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. from zope.interface import Interface, Attribute, implements from sat.tools.common import data_objects import shortuuid class ISATSession(Interface): profile = Attribute("Sat profile") jid = Attribute("JID associated with the profile") uuid = Attribute("uuid associated with the profile session") identities = Attribute("Identities of XMPP entities") class SATSession(object): implements(ISATSession) def __init__(self, session): self.profile = None self.jid = None self.uuid = unicode(shortuuid.uuid()) self.identities = data_objects.Identities() self.csrf_token = unicode(shortuuid.uuid()) self.flags = set() class ISATGuestSession(Interface): id = Attribute("UUID of the guest") data = Attribute("data associated with the guest") class SATGuestSession(object): implements(ISATGuestSession) def __init__(self, session): self.id = None self.data = None