[z3-checkins] r42029 - z3/sqlos/trunk/src/sqlos

kobold at codespeak.net kobold at codespeak.net
Fri Apr 13 14:26:11 CEST 2007


Author: kobold
Date: Fri Apr 13 14:26:10 2007
New Revision: 42029

Modified:
   z3/sqlos/trunk/src/sqlos/connection.py
Log:
Fixed a bug.


Modified: z3/sqlos/trunk/src/sqlos/connection.py
==============================================================================
--- z3/sqlos/trunk/src/sqlos/connection.py	(original)
+++ z3/sqlos/trunk/src/sqlos/connection.py	Fri Apr 13 14:26:10 2007
@@ -50,11 +50,14 @@
                 ut = getUtility(IConnectionName, context=context)
                 name = ut.name
             except ComponentLookupError: 
-                return None
+                return self
+
         # get the connection from the global thread cache
         try:
             return getConnection(context, name)
         except ComponentLookupError:
+            warnings.warn("Couldn't find ISQLConnectionName utility. "
+                "Please verify your setup.", SQLOSWarning, 2)
             return None
 
     def __set__(self, inst, value):
@@ -77,9 +80,9 @@
                                     default=None,
                                     context=context)
         if newconn is None:
-            warnings.warn("Couldn't find a rdb connection by the "
-                          "name %s. Please verify your setup." % name,
-                          SQLOSWarning, 3)
+            warnings.warn("Couldn't find a rdb connection by the name %s. "
+                "Please verify your setup." % name, SQLOSWarning, 3)
+            return None
         conn = IZopeSQLConnection(newconn())
         if conn.supportTransactions:
             connCache[key] = conn.transaction()


More information about the z3-checkins mailing list