diff src/server/session_iface.py @ 919:7b267496da1d

server: moved session interfaces to session_iface module + added SATGuestSession
author Goffi <goffi@goffi.org>
date Wed, 29 Mar 2017 19:46:04 +0200
parents
children 92f0eeb6dc72
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/server/session_iface.py	Wed Mar 29 19:46:04 2017 +0200
@@ -0,0 +1,47 @@
+#!/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
+import shortuuid
+
+class ISATSession(Interface):
+    profile = Attribute("Sat profile")
+    jid = Attribute("JID associated with the profile")
+    uuid = Attribute("uuid associated with the profile session")
+
+
+class SATSession(object):
+    implements(ISATSession)
+
+    def __init__(self, session):
+        self.profile = None
+        self.jid = None
+        self.uuid = unicode(shortuuid.uuid())
+
+
+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