commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnue] r9930 - in trunk/gnue-common/src: apps datasources/drivers/Base d


From: reinhard
Subject: [gnue] r9930 - in trunk/gnue-common/src: apps datasources/drivers/Base datasources/drivers/DBSIG2
Date: Mon, 5 Oct 2009 17:17:58 -0500 (CDT)

Author: reinhard
Date: 2009-10-05 17:17:57 -0500 (Mon, 05 Oct 2009)
New Revision: 9930

Modified:
   trunk/gnue-common/src/apps/GBaseApp.py
   trunk/gnue-common/src/datasources/drivers/Base/Connection.py
   trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
Log:
Use new logging module in some places already.


Modified: trunk/gnue-common/src/apps/GBaseApp.py
===================================================================
--- trunk/gnue-common/src/apps/GBaseApp.py      2009-10-05 22:16:50 UTC (rev 
9929)
+++ trunk/gnue-common/src/apps/GBaseApp.py      2009-10-05 22:17:57 UTC (rev 
9930)
@@ -339,9 +339,9 @@
             raise StartupError, \
                 u_('The debug_level option ("-d") expects numerical values.')
 
-        assert gDebug(2, "Python %s" % sys.version)
-        assert gDebug(2, "Run Options: %s" % opt)
-        assert gDebug(2, "Run Arguments: %s" % self.ARGUMENTS)
+        assert log.debug("Python %s" % sys.version)
+        assert log.debug("Run Options: %s" % opt)
+        assert log.debug("Run Arguments: %s" % self.ARGUMENTS)
 
         # Read the config files
         if application:
@@ -367,7 +367,7 @@
 
         # Get the connection definitions
         if connections != None:
-            assert gDebug(7,"Reusing connections instance")
+            assert log.debug("Reusing connections instance")
             self.connections = connections
         elif self.USE_CONNECTIONS:
 
@@ -387,7 +387,7 @@
                 self.connections_file = os.path.join(paths.config,
                         "connections.conf")
 
-            assert gDebug(2, 'Connection Definition: "%s"' %
+            assert log.debug('Connection Definition: "%s"' %
                     self.connections_file)
 
             try:
@@ -671,7 +671,7 @@
                     % psplit[0]
             parameters[psplit[0].lower()] = psplit[1]
 
-            assert gDebug(2,'Param "%s"="%s" ' % (psplit[0].lower(), 
psplit[1]))
+            assert log.debug('Param "%s"="%s" ' % (psplit[0].lower(), 
psplit[1]))
 
         return parameters
 

Modified: trunk/gnue-common/src/datasources/drivers/Base/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/Connection.py        
2009-10-05 22:16:50 UTC (rev 9929)
+++ trunk/gnue-common/src/datasources/drivers/Base/Connection.py        
2009-10-05 22:17:57 UTC (rev 9930)
@@ -27,6 +27,7 @@
 
 __all__ = ['Connection']
 
+from gnue.common.base import log
 from gnue.common.apps import GDebug, plugin
 from gnue.common.datasources import GConnections, GSchema
 
@@ -168,12 +169,11 @@
     @raise errors.AdminError: if the communication with the backend fails.
     """
 
-    assert gEnter (8)
-    result = self._getLoginFields_ ()
-    assert gLeave (8, result)
-    return result
+    return self._getLoginFields_ ()
 
+  getLoginFields = log.logged_f(getLoginFields)
 
+
   # ---------------------------------------------------------------------------
   # Connect to the backend
   # ---------------------------------------------------------------------------
@@ -192,12 +192,12 @@
 
     checktype (connectData, dict)
 
-    assert gEnter (8)
     self._connect_ (connectData)
     self._beginTransaction_ ()
-    assert gLeave (8)
 
+  connect = log.logged_f(connect)
 
+
   # ---------------------------------------------------------------------------
   # Initialize a new record with default data
   # ---------------------------------------------------------------------------
@@ -216,12 +216,11 @@
     checktype (table, basestring)
     checktype (fields, list)
 
-    assert gEnter (8)
-    result = self._initialize_ (table, fields)
-    assert gLeave (8, result)
-    return result
+    return self._initialize_ (table, fields)
 
+  initialize = log.logged_f(initialize)
 
+
   # ---------------------------------------------------------------------------
   # Insert a new record in the backend
   # ---------------------------------------------------------------------------
@@ -243,13 +242,13 @@
     checktype (table, basestring)
     checktype (newfields, dict)
 
-    assert gEnter (8)
     rowid = self._insert_ (table, oldfields, newfields)
     self.__pending = True
-    assert gLeave (8, rowid)
     return rowid
 
+  insert = log.logged_f(insert)
 
+
   # ---------------------------------------------------------------------------
   # Update an existing record in the backend
   # ---------------------------------------------------------------------------
@@ -270,12 +269,12 @@
     checktype (oldfields, dict)
     checktype (newfields, dict)
 
-    assert gEnter (8)
     self._update_ (table, oldfields, newfields)
     self.__pending = True
-    assert gLeave (8)
 
+  update = log.logged_f(update)
 
+
   # ---------------------------------------------------------------------------
   # Delete a record from the backend
   # ---------------------------------------------------------------------------
@@ -294,12 +293,12 @@
     checktype (table, basestring)
     checktype (oldfields, dict)
 
-    assert gEnter (8)
     self._delete_ (table, oldfields)
     self.__pending = True
-    assert gLeave (8)
 
+  delete = log.logged_f(delete)
 
+
   # ---------------------------------------------------------------------------
   # Requery an existing record to reflect changes done by the backend
   # ---------------------------------------------------------------------------
@@ -321,11 +320,9 @@
     checktype (oldfields, dict)
     checktype (fields, list)
 
-    assert gEnter (8)
-    result = self._requery_ (table, oldfields, fields)
-    assert gLeave (8, result)
-    return result
+    return self._requery_ (table, oldfields, fields)
 
+  requery = log.logged_f(requery)
 
 
   # ---------------------------------------------------------------------------
@@ -351,15 +348,15 @@
     checktype (methodname, basestring)
     checktype (parameters, dict)
 
-    assert gEnter (8)
     result = self._call_ (table, oldfields, methodname, parameters)
     # FIXME: Some calls should not make the connection pending, like requesting
     # the generated form. Most others should.
     # self.__pending = True
-    assert gLeave (8, result)
     return result
 
+  call = log.logged_f(call)
 
+
   # ---------------------------------------------------------------------------
   # Check if the connection has posted but not yet committed changes
   # ---------------------------------------------------------------------------
@@ -387,13 +384,13 @@
       the backend.
     """
 
-    assert gEnter (8)
     self._commit_ ()
     self.__pending = False
     self._beginTransaction_ ()
-    assert gLeave (8)
 
+  commit = log.logged_f(commit)
 
+
   # ---------------------------------------------------------------------------
   # Undo any uncommitted changes in the backend
   # ---------------------------------------------------------------------------
@@ -406,13 +403,13 @@
       on the backend.
     """
 
-    assert gEnter (8)
     self._rollback_ ()
     self.__pending = False
     self._beginTransaction_ ()
-    assert gLeave (8)
 
+  rollback = log.logged_f(rollback)
 
+
   # ---------------------------------------------------------------------------
   # Close the connection to the backend
   # ---------------------------------------------------------------------------
@@ -425,12 +422,12 @@
       the backend.
     """
 
-    assert gEnter (8)
     self._close_ ()
     self.manager._connectionClosed (self)
-    assert gLeave (8)
 
+  close = log.logged_f(close)
 
+
   # ---------------------------------------------------------------------------
   # Create a new database for this connection
   # ---------------------------------------------------------------------------

Modified: trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py      
2009-10-05 22:16:50 UTC (rev 9929)
+++ trunk/gnue-common/src/datasources/drivers/DBSIG2/Connection.py      
2009-10-05 22:17:57 UTC (rev 9930)
@@ -30,6 +30,7 @@
 import datetime
 import sys
 
+from gnue.common.base import log
 from gnue.common.apps import errors, GDebug
 from gnue.common.datasources import Exceptions
 from gnue.common.datasources.drivers import Base
@@ -125,7 +126,7 @@
 
   def _connect_ (self, connectData):
     (params, kwargs) = self._getConnectParams_ (connectData)
-    assert gDebug (3, 'DBSIG2 Connect')
+    assert log.debug_n('gnue.common.datasources.sql', "Connect")
     try:
       self._native = self._driver.connect (*params, **kwargs)
     except self._driver.DatabaseError, e:
@@ -188,7 +189,7 @@
   # ---------------------------------------------------------------------------
 
   def _commit_ (self):
-    assert gDebug (3, 'DBSIG2 Commit')
+    assert log.debug_n('gnue.common.datasources.sql', "Commit")
     try:
       self._native.commit ()
     except self._driver.DatabaseError, e:
@@ -197,14 +198,14 @@
   # ---------------------------------------------------------------------------
 
   def _rollback_ (self):
-    assert gDebug (3, 'DBSIG2 Rollback')
+    assert log.debug_n('gnue.common.datasources.sql', "Rollback")
     if hasattr (self._native, 'rollback'):
       self._native.rollback ()
 
   # ---------------------------------------------------------------------------
 
   def _close_ (self):
-    assert gDebug (3, 'DBSIG2 Close')
+    assert log.debug_n('gnue.common.datasources.sql', "Close")
     if self._native:
       self._native.close ()
 
@@ -356,8 +357,8 @@
     else:
       p = None
 
-    assert gDebug (3, "DBSIG2 Statement: %s" % s)
-    assert gDebug (3, "DBSIG2 Parameters: %s" % p)
+    assert log.debug_n('gnue.common.datasources.sql', "Statement: %s" % s)
+    assert log.debug_n('gnue.common.datasources.sql', "Parameters: %s" % p)
 
     # Create DBSIG2 cursor and execute statement
     cursor = self._native.cursor ()





reply via email to

[Prev in Thread] Current Thread [Next in Thread]