Changeset 3182 for pykota/trunk

Show
Ignore:
Timestamp:
05/30/07 21:02:51 (17 years ago)
Author:
jerome
Message:

Improved error message whenever the PostgreSQL connection fails.
Removed (commented out) some unnecessary debugging messages.

Files:
1 modified

Legend:

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

    r3133 r3182  
    5252         
    5353        self.tool.logdebug("Trying to open database (host=%s, port=%s, dbname=%s, user=%s)..." % (host, port, dbname, user)) 
    54         self.database = pg.connect(host=host, port=port, dbname=dbname, user=user, passwd=passwd) 
     54        try : 
     55            self.database = pg.connect(host=host, port=port, dbname=dbname, user=user, passwd=passwd) 
     56        except PGError, msg :     
     57            msg = "%(msg)s --- the most probable cause of your problem is that PostgreSQL is down, or doesn't accept incoming connections because you didn't configure it as explained in PyKota's documentation." % locals() 
     58            raise PGError, msg 
    5559        self.closed = 0 
    5660        try : 
     
    7882        after = time.time() 
    7983        self.tool.logdebug("Transaction committed.") 
    80         self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before)) 
     84        #self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before)) 
    8185         
    8286    def rollbackTransaction(self) :      
     
    8589        after = time.time() 
    8690        self.tool.logdebug("Transaction aborted.") 
    87         self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before)) 
     91        #self.tool.logdebug("Transaction duration : %.4f seconds" % (after - self.before)) 
    8892         
    8993    def doRawSearch(self, query) : 
     
    100104        else :     
    101105            after = time.time() 
    102             self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 
     106            #self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 
    103107            return result 
    104108             
     
    123127        else :     
    124128            after = time.time() 
    125             self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 
     129            #self.tool.logdebug("Query Duration : %.4f seconds" % (after - before)) 
    126130            return result 
    127131