Skip to content

Commit faedbb7

Browse files
author
James William Pye
committed
Broken.
Revert "Update postgresql/clientparameters.py" This reverts commit 91fcd54.
1 parent ab1c392 commit faedbb7

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

postgresql/clientparameters.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@ class ClientParameterError(Error):
4646
class ServiceDoesNotExistError(ClientParameterError):
4747
code = '-*srv'
4848

49-
# on win32 when program is run as windows service, getuser falls back to pwn which is not implemented
50-
# therefore it is better to resign from getting default username, which allows service operation
51-
52-
getpass = raw_input
53-
54-
def getuser():
55-
return 'postgres'
49+
try:
50+
from getpass import getuser, getpass
51+
except ImportError:
52+
getpass = raw_input
53+
def getuser():
54+
return 'postgres'
5655

5756
default_host = 'localhost'
5857
default_port = 5432
@@ -142,9 +141,6 @@ def defaults(environ = os.environ):
142141
if appdata:
143142
pgdata = os.path.join(appdata, pg_appdata_directory)
144143
pgpassfile = os.path.join(pgdata, pg_appdata_passfile)
145-
else:
146-
pgdata = ''
147-
pgpassfile = ''
148144
else:
149145
pgpassfile = os.path.join(userdir, pg_home_passfile)
150146

0 commit comments

Comments
 (0)