Skip to content

Commit

Permalink
Fix python-postgres#91: pgpassfile is not defined at w32 because APPD…
Browse files Browse the repository at this point in the history
…ATA is not defined
  • Loading branch information
phdru committed Aug 23, 2017
1 parent 7d7706e commit acea988
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion postgresql/clientparameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def defaults(environ = os.environ):
if appdata:
pgdata = os.path.join(appdata, pg_appdata_directory)
pgpassfile = os.path.join(pgdata, pg_appdata_passfile)
else:
pgpassfile = None
else:
pgpassfile = os.path.join(userdir, pg_home_passfile)

Expand All @@ -157,7 +159,7 @@ def defaults(environ = os.environ):
('sslrootcrlfile', os.path.join(pgdata, 'root.crl')),
('pgpassfile', pgpassfile),
):
if os.path.exists(v):
if v and os.path.exists(v):
yield (k,), v

def envvars(environ = os.environ, modifier : "environment variable key modifier" = 'PG'.__add__):
Expand Down

0 comments on commit acea988

Please sign in to comment.