Changeset 1021 for pykota/trunk/pykota/storage.py
- Timestamp:
- 06/10/03 18:37:54 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storage.py
r952 r1021 21 21 # 22 22 # $Log$ 23 # Revision 1.13 2003/06/10 16:37:54 jalet 24 # Deletion of the second user which is not needed anymore. 25 # Added a debug configuration field in /etc/pykota.conf 26 # All queries can now be sent to the logger in debug mode, this will 27 # greatly help improve performance when time for this will come. 28 # 23 29 # Revision 1.12 2003/04/23 22:13:57 jalet 24 30 # Preliminary support for LPRng added BUT STILL UNTESTED. … … 78 84 __str__ = __repr__ 79 85 80 def openConnection( config, asadmin=0) :86 def openConnection(pykotatool) : 81 87 """Returns a connection handle to the appropriate Quota Storage Database.""" 82 backendinfo = config.getStorageBackend()88 backendinfo = pykotatool.config.getStorageBackend() 83 89 backend = backendinfo["storagebackend"] 84 90 try : … … 86 92 # don't trust user input 87 93 raise ImportError 94 # 95 # TODO : descending compatibility 96 # 97 if backend == "postgresql" : 98 backend = "pgstorage" # TODO : delete, this is for descending compatibility only 88 99 exec "from pykota.storages import %s as storagebackend" % backend.lower() 89 100 except ImportError : … … 93 104 database = backendinfo["storagename"] 94 105 admin = backendinfo["storageadmin"] 95 user = backendinfo["storageuser"]96 106 adminpw = backendinfo["storageadminpw"] 97 userpw = backendinfo["storageuserpw"] 98 if asadmin : 99 return getattr(storagebackend, "Storage")(host, database, admin, adminpw) 100 else : 101 return getattr(storagebackend, "Storage")(host, database, user, userpw) 107 return getattr(storagebackend, "Storage")(pykotatool, host, database, admin, adminpw) 102 108