Changeset 859 for pykota/trunk/pykota/storages/postgresql.py
- Timestamp:
- 03/22/03 14:11:33 (21 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/pykota/storages/postgresql.py
r800 r859 15 15 # 16 16 # $Log$ 17 # Revision 1.5 2003/03/22 13:11:33 jalet 18 # The port on which the Quota Storage Sever is listening can now 19 # be set in the configuration file (see sample). 20 # Better error handling if PygreSQL is not installed. 21 # Improved documentation. 22 # Version number changed to 1.02alpha 23 # 17 24 # Revision 1.4 2003/02/17 22:05:50 jalet 18 25 # Storage backend now supports admin and user passwords (untested) … … 30 37 # 31 38 32 import pg 39 try : 40 import pg 41 except ImportError : 42 import sys 43 sys.stderr.write("This python version (%s) doesn't seem to have the PygreSQL module installed correctly.\n" % sys.version.split()[0]) 44 raise 33 45 34 46 from pykota.storage import PyKotaStorageError … … 40 52 self.closed = 1 41 53 try : 42 self.database = pg.connect(host=host, dbname=dbname, user=user, passwd=passwd) 54 (host, port) = host.split(":") 55 port = int(port) 56 except ValueError : 57 port = -1 # Use PostgreSQL's default tcp/ip port (5432). 58 59 try : 60 self.database = pg.connect(host=host, port=port, dbname=dbname, user=user, passwd=passwd) 43 61 self.closed = 0 44 62 except pg.error, msg :