Changeset 2031

Show
Ignore:
Timestamp:
01/19/05 09:48:17 (20 years ago)
Author:
jalet
Message:

Fix exception's name wrt newer versions of PygreSQL

Files:
1 modified

Legend:

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

    r1717 r2031  
    2222# 
    2323# $Log$ 
     24# Revision 1.38  2005/01/19 08:48:17  jalet 
     25# Fix exception's name wrt newer versions of PygreSQL 
     26# 
    2427# Revision 1.37  2004/09/14 22:29:12  jalet 
    2528# First version of dumpykota. Works fine but only with PostgreSQL backend 
     
    159162    # TODO : to translate or not to translate ? 
    160163    raise PyKotaStorageError, "This python version (%s) doesn't seem to have the PygreSQL module installed correctly." % sys.version.split()[0] 
     164else :     
     165    try : 
     166        PGError = pg.Error 
     167    except AttributeError :     
     168        PGError = pg.error 
    161169 
    162170class Storage(BaseStorage, SQLStorage) : 
     
    172180        try : 
    173181            self.database = pg.connect(host=host, port=port, dbname=dbname, user=user, passwd=passwd) 
    174         except pg.error, msg : 
     182        except PGError, msg : 
    175183            raise PyKotaStorageError, msg 
    176184        else :     
     
    208216            self.tool.logdebug("QUERY : %s" % query) 
    209217            result = self.database.query(query) 
    210         except pg.error, msg :     
     218        except PGError, msg :     
    211219            raise PyKotaStorageError, msg 
    212220        else :     
     
    227235            self.tool.logdebug("QUERY : %s" % query) 
    228236            result = self.database.query(query) 
    229         except pg.error, msg :     
     237        except PGError, msg :     
    230238            raise PyKotaStorageError, msg 
    231239        else :