Skip to content

Commit 9a332ea

Browse files
author
James William Pye
committed
Fix serialization of driver parameters in IRI.
Aside: cast the incoming timeout if it is not None.
1 parent 535e4b0 commit 9a332ea

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

postgresql/driver/pq3.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2835,15 +2835,15 @@ def _pq_iri(self):
28352835
{
28362836
k : v for k,v in self.__dict__.items()
28372837
if v is not None \
2838-
and k not in ('_startup_parameters', '_address_family', '_pq_iri')
2838+
and k not in ('_startup_parameters', '_address_family', '_pq_iri', 'ife_ancestor')
28392839
},
28402840
obscure_password = True
28412841
)
28422842

28432843
def __repr__(self):
28442844
keywords = (',' + os.linesep + ' ').join([
28452845
'%s = %r' %(k, getattr(self, k, None)) for k in self.__dict__
2846-
if k not in ('_startup_parameters', '_address_family', '_pq_iri') \
2846+
if k not in ('_startup_parameters', '_address_family', '_pq_iri', 'ife_ancestor') \
28472847
and getattr(self, k, None) is not None
28482848
])
28492849
return '{mod}.{name}({keywords})'.format(
@@ -2926,7 +2926,7 @@ def __init__(self,
29262926
class SocketCreator(object):
29272927
def __call__(self, timeout = None):
29282928
s = socket.socket(*self.socket_create)
2929-
s.settimeout(timeout)
2929+
s.settimeout(float(timeout) if timeout is not None else None)
29302930
s.connect(self.socket_connect)
29312931
s.settimeout(None)
29322932
return s

postgresql/iri.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def construct_path(x, re = escape_path_re):
9292
def construct(x, obscure_password = False):
9393
'Construct a RI dictionary from a clientparams dictionary'
9494
# the rather exhaustive settings choreography is due to
95-
# a desire to allow
95+
# a desire to allow the search_path to be appended in the fragment
9696
settings = x.get('settings')
9797
no_path_settings = None
9898
search_path = None
@@ -157,7 +157,8 @@ def construct(x, obscure_password = False):
157157
ri.escape_path_re.sub(path_comp, '/')
158158
for path_comp in path
159159
]),
160-
None if no_path_settings is None else (
160+
(ri.construct_query(driver_params) if driver_params else None)
161+
if no_path_settings is None else (
161162
ri.construct_query(
162163
driver_params + no_path_settings
163164
)

0 commit comments

Comments
 (0)