[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7036 - trunk/gnue-appserver/src
From: |
reinhard |
Subject: |
[gnue] r7036 - trunk/gnue-appserver/src |
Date: |
Wed, 16 Feb 2005 17:32:00 -0600 (CST) |
Author: reinhard
Date: 2005-02-16 17:31:59 -0600 (Wed, 16 Feb 2005)
New Revision: 7036
Modified:
trunk/gnue-appserver/src/geasInstance.py
trunk/gnue-appserver/src/geasSession.py
trunk/gnue-appserver/src/geasSessionManager.py
Log:
Updated comment for list id, use address also for session id.
Modified: trunk/gnue-appserver/src/geasInstance.py
===================================================================
--- trunk/gnue-appserver/src/geasInstance.py 2005-02-16 23:05:53 UTC (rev
7035)
+++ trunk/gnue-appserver/src/geasInstance.py 2005-02-16 23:31:59 UTC (rev
7036)
@@ -307,7 +307,7 @@
checktype (namespace, [types.NoneType, types.DictType])
# Create a session object which with the actual session id
- sess = Session.Session (self.__session.sm, self.__session.id,
+ sess = Session.Session (self.__session.sm, id (self.__session),
self.__session.parameters)
# Create an object representing the current business object
Modified: trunk/gnue-appserver/src/geasSession.py
===================================================================
--- trunk/gnue-appserver/src/geasSession.py 2005-02-16 23:05:53 UTC (rev
7035)
+++ trunk/gnue-appserver/src/geasSession.py 2005-02-16 23:31:59 UTC (rev
7036)
@@ -97,7 +97,7 @@
# Initalize
# ---------------------------------------------------------------------------
- def __init__ (self, connections, authAdapter, sm, sid, params):
+ def __init__ (self, connections, authAdapter, sm, params):
self.loggedIn = 0
self.connections = connections
@@ -112,8 +112,7 @@
self.__dirtyInstances = {}
self.__operation = None
- self.sm = sm # The session manager
- self.id = sid # The session id
+ self.sm = sm # The session manager
self.parameters = params
self.locale = params.get ('language')
self.user = None
@@ -391,6 +390,9 @@
list = geasList.geasList (self, classdef, self.__connection, recordset,
[u'gnue_id'] + propertylist, asCond, dsSort, asSort)
+ # We use the address of the geasList object in memory as the list id. This
+ # way, every list gets a really unique list id, and this is even thread
+ # safe.
list_id = id (list)
self.__lists [list_id] = list
Modified: trunk/gnue-appserver/src/geasSessionManager.py
===================================================================
--- trunk/gnue-appserver/src/geasSessionManager.py 2005-02-16 23:05:53 UTC
(rev 7035)
+++ trunk/gnue-appserver/src/geasSessionManager.py 2005-02-16 23:31:59 UTC
(rev 7036)
@@ -58,7 +58,6 @@
def __init__ (self, connections, modulepath = None):
self._connections = connections
- self._sessNo = 0
self._sessions = {}
self._buildInternalSession ()
self._modulepath = modulepath or \
@@ -90,8 +89,13 @@
def _buildInternalSession (self):
self._internalSession = geasSession.geasSession (self._connections,
- geasAuthentication.geasAuthAgent(), self, 0, {})
+ geasAuthentication.geasAuthAgent(), self, {})
self._internalSession.login (None, None) # fake login
+
+ # Some parts of the code access with session ID 0, so we have to store it
+ # as "session zero", too. The correct session id is used for procedure
+ # calls.
+ self._sessions [id (self._internalSession)] = self._internalSession
self._sessions [0] = self._internalSession
# ---------------------------------------------------------------------------
@@ -217,9 +221,6 @@
def open (self, authentication):
- # TODO use a better session ID than this one
- self._sessNo = self._sessNo + 1
-
loginHandler = self._connections._loginHandler
loginOptions = self._connections._loginOptions
location = self._connections._location
@@ -227,12 +228,17 @@
conn = GConnections.GConnections(location, loginHandler, loginOptions)
sess = geasSession.geasSession (conn, self._authAdapter, self,
- self._sessNo, authentication)
+ authentication)
sess.login (authentication ['user'], authentication ['password'])
- self._sessions [self._sessNo] = sess
- return self._sessNo
+ # We use the memory address of the geasSession object as session id. This
+ # is always unique and even thread safe.
+ session_id = id (sess)
+ self._sessions [session_id] = sess
+
+ return session_id
+
# ---------------------------------------------------------------------------
# Close the connection
# ---------------------------------------------------------------------------
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7036 - trunk/gnue-appserver/src,
reinhard <=