[Checkins] SVN: z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py Speed up getSession in case the session already exists

Kartnaller Jurgen cvs-admin at zope.org
Sun Jun 18 06:04:05 EDT 2006


Log message for revision 68731:
  Speed up getSession in case the session already exists

Changed:
  U   z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py

-=-
Modified: z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py
===================================================================
--- z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2006-06-18 05:35:59 UTC (rev 68730)
+++ z3c.zalchemy/trunk/src/z3c/zalchemy/datamanager.py	2006-06-18 10:04:01 UTC (rev 68731)
@@ -63,12 +63,12 @@
 _storage = local()
 
 def getSession(createTransaction=False):
+    session=getattr(_storage,'session',None)
+    if session:
+        return session
     txn = transaction.manager.get()
     if createTransaction and (txn is None):
         txn = transaction.begin()
-    session=getattr(_storage,'session',None)
-    if session:
-        return session
     util = queryUtility(IAlchemyEngineUtility)
     engine = None
     if util is not None:



More information about the Checkins mailing list