commit-gnue
[Top][All Lists]
Advanced

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

r5280 - trunk/gnue-common/src/datasources


From: jcater
Subject: r5280 - trunk/gnue-common/src/datasources
Date: Tue, 9 Mar 2004 14:39:50 -0600 (CST)

Author: jcater
Date: 2004-03-09 14:39:49 -0600 (Tue, 09 Mar 2004)
New Revision: 5280

Modified:
   trunk/gnue-common/src/datasources/GConnections.py
Log:
added support for driver aliases; for example, sapdb can now be referenced as 
either provider=sapdb or provider=maxdb and interbase can be referenced as 
either provider=interbase or provider=firebird

Modified: trunk/gnue-common/src/datasources/GConnections.py
===================================================================
--- trunk/gnue-common/src/datasources/GConnections.py   2004-03-09 17:51:28 UTC 
(rev 5279)
+++ trunk/gnue-common/src/datasources/GConnections.py   2004-03-09 20:39:49 UTC 
(rev 5280)
@@ -41,7 +41,7 @@
 from gnue.common.apps import GDebug
 from gnue.common.datasources import Exceptions
 from gnue.common.datasources import GLoginHandler
-from gnue.common.datasources.drivers import DRIVERS as ALLDRIVERS
+from gnue.common.datasources.drivers import DRIVERS as ALLDRIVERS, ALIASES as 
DRIVERALIASES
 from gnue.common.utils.FileUtils import openResource, dyn_import
 import GLoginHandler
 
@@ -249,7 +249,7 @@
       tmsg = _("The database driver '%s' doesn't have a 'Connection' 
object.\n"+\
                "It has to be updated to the new driver API. --- "+\
                "Please contact a gnue developer.") % driver
-      raise Exceptions.ProviderNotSupportedError, tmsg      
+      raise Exceptions.ProviderNotSupportedError, tmsg
 
     try:
       conn = dbdriver.Connection(self, connection_name, parameters)
@@ -260,7 +260,7 @@
       # module. i.e. there is a Connection.py file
       # TODO: remove this extra check by cleaning up the whole loading 
procedure
       conn = dbdriver.Connection.Connection(self, connection_name, parameters)
-    
+
     self._openConnections[connection_name] = conn
 
     if login:
@@ -342,7 +342,7 @@
         # password 'mypassword'
         # EOF
         # (Remark: if .netrc should work under Win32 you have to
-       #  set the HOME environement variable [SET HOME=...])
+        #  set the HOME environement variable [SET HOME=...])
 
         netrcData = netrc.netrc().authenticators(
               "'gnue://%s/'" % connection_base )
@@ -426,7 +426,7 @@
             # Ok, then "those address@hidden users"
             attempts = attempts - 1
             errortext = string.replace("%s" % error,'\n','')
-           self._loginHandler.destroyLoginDialog()
+            self._loginHandler.destroyLoginDialog()
 
             if not attempts:
               # Four times is plenty...
@@ -463,8 +463,8 @@
         return self._authenticatedUsers[connection]
     except (KeyError, IndexError):
       return None
-    
-  
+
+
   def commitAll(self):
     """
     This function commits all transactions
@@ -489,6 +489,8 @@
 def _find_base_driver (driver, modules, path=[]):
   if driver in modules:
     return 'gnue.common.datasources.drivers.' + string.join(path + 
[driver],'.')
+  elif DRIVERALIASES.has_key(driver) and DRIVERALIASES[driver] in modules:
+    return 'gnue.common.datasources.drivers.' + string.join(path + 
[DRIVERALIASES[driver]],'.')
   else:
     for module in modules:
       GDebug.printMesg(5,"trying module: %s" % module)





reply via email to

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