[Zope-CVS] CVS: Products/Ape/lib/apelib/sql - dbapi.py:1.8

Shane Hathaway shane at zope.com
Wed Mar 24 10:52:38 EST 2004


Update of /cvs-repository/Products/Ape/lib/apelib/sql
In directory cvs.zope.org:/tmp/cvs-serv26065/lib/apelib/sql

Modified Files:
	dbapi.py 
Log Message:
Brought the ZConfig schema for SQL databases up to date with the current code.


=== Products/Ape/lib/apelib/sql/dbapi.py 1.7 => 1.8 ===
--- Products/Ape/lib/apelib/sql/dbapi.py:1.7	Sat Mar 20 01:34:23 2004
+++ Products/Ape/lib/apelib/sql/dbapi.py	Wed Mar 24 10:52:07 2004
@@ -37,18 +37,18 @@
     column_type_translations = {}  # { local type name -> db type name }
     column_name_translations = {}  # { local col name -> db col name }
 
-    def __init__(self, module_name, connect_args, prefix='zodb_'):
-        # connect_args is a Python expression.
+    def __init__(self, module_name, connect_expression, prefix='zodb_'):
+        # connect_expression is a Python expression.
         self.module_name = module_name
         self.module = __import__(module_name, {}, {}, ('__doc__',))
-        self.connect_args = connect_args
+        self.connect_expression = connect_expression
         self.prefix = prefix
         self.connector = None
         self._final = 0
 
     def __repr__(self):
-        return '<%s(%s(%s))>' % (
-            self.__class__.__name__, self.module_name, self.connect_args)
+        return '<%s(module_name=%s)>' % (
+            self.__class__.__name__, repr(self.module_name))
 
     def translate_name(self, column_name):
         """Returns a column name for a variable name.
@@ -270,9 +270,7 @@
 
     def connect(self):
         d = {'connect': self.module.connect}
-        code = "connector = connect(%s)" % self.connect_args
-        exec code in d
-        self.connector = d['connector']
+        self.connector = eval(self.connect_expression, d)
 
     def sortKey(self):
         return repr(self)




More information about the Zope-CVS mailing list