Ignore:
Timestamp:
20/01/09 16:22:37 (11 years ago)
Author:
cbyrom
Message:

Add default config file to postgresclient - to check for and use when
setting up a connection, when a config file isn't specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/clients/reldb/postgres/postgresclient.py

    r4848 r4853  
    11''' 
    2 Client for accessing postgres DB 
     2Client for accessing and running SQL statements against a postgres DB 
    33 
    44@author: C Byrom, Jan 09, Tessella 
     
    88import ndg.common.src.clients.xmldb.eXist.existdbclient as edc 
    99 
     10DEFAULT_CONFIG_FILE = 'pg.config' 
    1011 
    1112class PostgresClient(object): 
     
    7980         
    8081        if not self.conn: 
    81             logging.error("DB connection not yet set up - run setupDBConnection(configFile) before trying to run a SQL command") 
    82             return None 
     82            # attempt to run with default password file 
     83            self.setupDBConnection(DEFAULT_CONFIG_FILE) 
     84             
     85            if not self.conn: 
     86                logging.error("DB connection not yet set up - run setupDBConnection(configFile) before trying to run a SQL command") 
     87                return None 
    8388         
    8489        cursor = self.conn.cursor() 
Note: See TracChangeset for help on using the changeset viewer.