Catch local connection config
If database backend is Postgres and the connection is over domain socket, the only values in <database> node are: * db_name * db_server * db_type Now, for some reason the config reader unconditionally creates "tidy" string representations for all possible keys. This means that host, user and password are all empty strings (''), and not even NoneType entities. To catch the case for postgres, simply treat empty host the same as undefined host.
This commit is contained in:
parent
23a4ca34c8
commit
105e868864
|
@ -182,7 +182,9 @@ class fpdb_db:
|
|||
# sqlcoder: This database only connect failed in my windows setup??
|
||||
# Modifed it to try the 4 parameter style if the first connect fails - does this work everywhere?
|
||||
connected = False
|
||||
if self.host == "localhost" or self.host == "127.0.0.1":
|
||||
if self.host == None or self.host == '' \
|
||||
or self.host == "localhost" \
|
||||
or self.host == "127.0.0.1":
|
||||
try:
|
||||
self.db = psycopg2.connect(database = database)
|
||||
connected = True
|
||||
|
|
Loading…
Reference in New Issue
Block a user