changeset 523:ba3c6c6cc952

more pyscopg2 connection defaults
author Catherine Devlin <catherine.devlin@gmail.com>
date Sat, 13 Nov 2010 06:07:46 -0500
parents 26bdff5abf78
children 96803d93b9ae
files sqlpython/connections.py
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/sqlpython/connections.py	Wed Nov 10 07:26:24 2010 -0500
+++ b/sqlpython/connections.py	Sat Nov 13 06:07:46 2010 -0500
@@ -346,9 +346,10 @@
     paramstyle = 'format'
     def set_defaults(self):
         self.port = os.getenv('PGPORT') or self.default_port
-        self.database = os.getenv('ORACLE_SID')
-        self.hostname = os.getenv('PGHOST') or 'localhost'
-        self.username = os.getenv('USER')
+        self.database = os.getenv('PGDATABASE')
+        self.hostname = os.getenv('PGHOST') or os.getenv('PGHOSTADDR') or 'localhost'
+        self.username = os.getenv('PGUSER') or os.getenv('USER')
+        self.password = os.getenv('PGPASSWORD')
     def connect(self):
         self.connection = psycopg2.connect(host = self.hostname, user = self.username, 
                                  password = self.password, database = self.database,