[Checkins] SVN: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/ some more fixes

Andreas Jung andreas at andreas-jung.com
Mon Jan 7 13:16:13 EST 2008


Log message for revision 82735:
  some more fixes
  

Changed:
  U   z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt
  U   z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py
  U   z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/util.py

-=-
Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt	2008-01-07 16:49:58 UTC (rev 82734)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/CHANGES.txt	2008-01-07 18:16:13 UTC (rev 82735)
@@ -22,9 +22,8 @@
 
   - Wrapper constructor now accepts two new optional dicts 
     'engine_options' and 'session_options' that will be passed down 
-    to the engine and the sessionmaker. Support for the generic 
-    **kw argument has been dropped (might raise a backward 
-    compatibility problem). Patch provided by Klaus Barthelmann.
+    to the engine and the sessionmaker.  Patch provided by 
+    Klaus Barthelmann.
 
  
 1.0.11 (30.07.2007)

Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py	2008-01-07 16:49:58 UTC (rev 82734)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/base.py	2008-01-07 18:16:13 UTC (rev 82735)
@@ -54,13 +54,11 @@
 
     implements(ISQLAlchemyWrapper)
 
-    def __init__(self, dsn, model=None, transactional=True, echo=False, engine_options=None, session_options=None):
+    def __init__(self, dsn, model=None, transactional=True, engine_options=None, session_options=Nonem, **kw):
         """ 'dsn' - a RFC-1738-style connection string
 
             'model' - optional instance of model.Model
 
-            'echo' - boolean controlling the verbosity of the engine
-
             'engine_options' - optional keyword arguments passed to create_engine()
 
             'session_options' - optional keyword arguments passed to create_session() or sessionmaker()
@@ -78,9 +76,10 @@
         self.dbname = self.url.database 
         self.drivername = self.url.drivername
         self.transactional = transactional
+        self.echo = kw.get('echo', False)
         self.engine_options = engine_options or {}
+        self.engine_options.update(echo=self.echo)
         self.session_options = session_options or {}
-        self.echo = echo
         self._model = None
         self._createEngine()
         self._id = str(random.random()) # used as unique key for session/connection cache

Modified: z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/util.py
===================================================================
--- z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/util.py	2008-01-07 16:49:58 UTC (rev 82734)
+++ z3c.sqlalchemy/trunk/src/z3c/sqlalchemy/util.py	2008-01-07 18:16:13 UTC (rev 82735)
@@ -28,7 +28,8 @@
 
 registeredWrappers = {}
 
-def createSAWrapper(dsn, model=None, forZope=False, name=None, transactional=True, engine_options=None, session_options=None):
+def createSAWrapper(dsn, model=None, forZope=False, name=None, transactional=True, 
+                    engine_options=None, session_options=None, **kw):
     """ Convenience method to generate a wrapper for a DSN and a model.
         This method hides all database related magic from the user. 
 
@@ -61,7 +62,10 @@
     if driver == 'postgres':
         klass = forZope and ZopePostgresWrapper or PythonPostgresWrapper
 
-    wrapper = klass(dsn, model, transactional, engine_options, session_options)
+    wrapper = klass(dsn, model, 
+                    transactional=transactional, 
+                    engine_options=engine_options, 
+                    session_options=session_options, **kw)
     if name is not None:
         registerSAWrapper(wrapper, name)
 



More information about the Checkins mailing list