Changeset 800 for pykota/trunk
- Timestamp:
- 02/17/03 23:06:07 (22 years ago)
- Location:
- pykota/trunk
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/conf/pykota.conf.sample
r794 r800 27 27 storageadmin: pykotaadmin 28 28 storageuser: pykotauser 29 # storageadminpw: NOT YET SUPPORTED30 # storageuserpw: NOT YET SUPPORTED29 # storageadminpw: Comment out if unused 30 # storageuserpw: Comment out if unused 31 31 32 32 # Where to log ? -
pykota/trunk/pykota/config.py
r789 r800 15 15 # 16 16 # $Log$ 17 # Revision 1.14 2003/02/17 22:05:50 jalet 18 # Storage backend now supports admin and user passwords (untested) 19 # 17 20 # Revision 1.13 2003/02/10 11:47:39 jalet 18 21 # Moved some code down into the requesters … … 90 93 for option in [ "storagebackend", "storageserver", \ 91 94 "storagename", "storageadmin", \ 92 "storageuser", # TODO : "storageadminpw", "storageusepw", \95 "storageuser", 93 96 "logger", "admin", "adminmail", 94 97 "smtpserver", "method", "gracedelay" ] : … … 130 133 131 134 def getStorageBackend(self) : 132 """Returns the storage backend information as a tuple. 133 134 The tuple has the form : 135 136 (backend, host, database, admin, user) 137 """ 138 backendinfo = [] 135 """Returns the storage backend information as a Python mapping.""" 136 backendinfo = {} 139 137 for option in [ "storagebackend", "storageserver", \ 140 138 "storagename", "storageadmin", \ 141 "storageuser", # TODO : "storageadminpw", "storageusepw",\139 "storageuser", \ 142 140 ] : 143 backendinfo.append(self.config.get("global", option, raw=1)) 144 return tuple(backendinfo) 141 backendinfo[option] = self.config.get("global", option, raw=1) 142 for option in [ "storageadminpw", "storageuserpw" ] : 143 if self.config.has_option("global", option) : 144 backendinfo[option] = self.config.get("global", option, raw=1) 145 else : 146 backendinfo[option] = None 147 return backendinfo 145 148 146 149 def getLoggingBackend(self) : -
pykota/trunk/pykota/storage.py
r791 r800 15 15 # 16 16 # $Log$ 17 # Revision 1.8 2003/02/17 22:05:50 jalet 18 # Storage backend now supports admin and user passwords (untested) 19 # 17 20 # Revision 1.7 2003/02/10 12:07:31 jalet 18 21 # Now repykota should output the recorded total page number for each printer too. … … 109 112 """Returns a connection handle to the appropriate Quota Storage Database.""" 110 113 (backend, host, database, admin, user) = config.getStorageBackend() 114 backendinfo = config.getStorageBackend() 115 backend = backendinfo["storagebackend"] 111 116 try : 112 117 if not backend.isalpha() : … … 117 122 raise PyKotaStorageError, _("Unsupported quota storage backend %s") % backend 118 123 else : 119 return getattr(storagebackend, "Storage")(host, database, (asadmin and admin) or user) 124 host = backendinfo["storageserver"] 125 database = backendinfo["storagename"] 126 admin = backendinfo["storageadmin"] 127 user = backendinfo["storageuser"] 128 adminpw = backendinfo["storageadminpw"] 129 userpw = backendinfo["storageuserpw"] 130 if asadmin : 131 return getattr(storagebackend, "Storage")(host, database, admin, adminpw) 132 else : 133 return getattr(storagebackend, "Storage")(host, database, user, userpw) 120 134 -
pykota/trunk/pykota/storages/postgresql.py
r720 r800 15 15 # 16 16 # $Log$ 17 # Revision 1.4 2003/02/17 22:05:50 jalet 18 # Storage backend now supports admin and user passwords (untested) 19 # 17 20 # Revision 1.3 2003/02/06 14:49:04 jalet 18 21 # edpykota should be ok now … … 33 36 34 37 class Storage(sql.SQLStorage) : 35 def __init__(self, host, dbname, user ) :38 def __init__(self, host, dbname, user, passwd) : 36 39 """Opens the PostgreSQL database connection.""" 37 40 self.closed = 1 38 41 try : 39 self.database = pg.connect(host=host, dbname=dbname, user=user )42 self.database = pg.connect(host=host, dbname=dbname, user=user, passwd=passwd) 40 43 self.closed = 0 41 44 except pg.error, msg :