Skip to content

Fix w32 problems at AppVeyor #92

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions postgresql/clientparameters.py
Original file line number Diff line number Diff line change
@@ -47,11 +47,17 @@ class ServiceDoesNotExistError(ClientParameterError):
code = '-*srv'

try:
from getpass import getuser, getpass
from getpass import getuser as _getuser, getpass
except ImportError:
getpass = raw_input
def getuser():
return 'postgres'
else:
def getuser():
try:
return _getuser()
except ImportError: # w32 doesn't have module pwd
return 'postgres'

default_host = 'localhost'
default_port = 5432
@@ -141,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)

@@ -151,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 = 'PG'.__add__):