Changeset 3499 for pykota

Show
Ignore:
Timestamp:
05/20/09 07:06:13 (15 years ago)
Author:
jerome
Message:

Fixed problem with PygreSQL v4.x

Files:
1 modified

Legend:

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

    r3489 r3499  
    5858                                                                                                  repr(user))) 
    5959        try : 
    60             self.database = pg.connect(host=host, 
    61                                        port=port, 
    62                                        dbname=dbname, 
    63                                        user=user, 
    64                                        passwd=passwd) 
     60            self.database = pg.DB(host=host, 
     61                                  port=port, 
     62                                  dbname=dbname, 
     63                                  user=user, 
     64                                  passwd=passwd) 
    6565        except PGError, msg : 
    6666            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() 
    6767            raise PGError, msg 
    6868        self.closed = False 
     69        try : 
     70            self.quote = self.database._quote 
     71        except AttributeError : # pg <v4.x 
     72            self.quote = pg._quote 
    6973        try : 
    7074            self.database.query("SET CLIENT_ENCODING TO 'UTF-8';") 
     
    137141        else : 
    138142            typ = "text" 
    139         return pg._quote(field, typ) 
     143        return self.quote(field, typ) 
    140144 
    141145    def prepareRawResult(self, result) :