Show
Ignore:
Timestamp:
03/22/03 14:11:33 (21 years ago)
Author:
jalet
Message:

The port on which the Quota Storage Sever is listening can now
be set in the configuration file (see sample).
Better error handling if PygreSQL is not installed.
Improved documentation.
Version number changed to 1.02alpha

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/storages/postgresql.py

    r800 r859  
    1515# 
    1616# $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# 
    1724# Revision 1.4  2003/02/17 22:05:50  jalet 
    1825# Storage backend now supports admin and user passwords (untested) 
     
    3037# 
    3138 
    32 import pg 
     39try : 
     40    import pg 
     41except 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 
    3345 
    3446from pykota.storage import PyKotaStorageError 
     
    4052        self.closed = 1 
    4153        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) 
    4361            self.closed = 0 
    4462        except pg.error, msg :