mirror of
https://github.com/psycopg/psycopg2.git
synced 2025-06-30 17:53:06 +03:00
Reproducing/documenting odd behaviours of connect()
This commit is contained in:
parent
625cc1b402
commit
e18d27c475
|
@ -149,8 +149,10 @@ def connect(dsn=None,
|
||||||
library: the list of supported parameter depends on the library version.
|
library: the list of supported parameter depends on the library version.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if dsn is None:
|
if dsn is None:
|
||||||
|
# Note: reproducing the behaviour of the previous C implementation:
|
||||||
|
# keyword are silently swallowed if a DSN is specified. I would have
|
||||||
|
# raised an exception. File under "histerical raisins".
|
||||||
items = []
|
items = []
|
||||||
if database is not None:
|
if database is not None:
|
||||||
items.append(('dbname', database))
|
items.append(('dbname', database))
|
||||||
|
@ -160,7 +162,9 @@ def connect(dsn=None,
|
||||||
items.append(('password', password))
|
items.append(('password', password))
|
||||||
if host is not None:
|
if host is not None:
|
||||||
items.append(('host', host))
|
items.append(('host', host))
|
||||||
if port is not None:
|
# Reproducing the previous C implementation behaviour: swallow a
|
||||||
|
# negative port. The libpq would raise an exception for it.
|
||||||
|
if port is not None and int(port) > 0:
|
||||||
items.append(('port', port))
|
items.append(('port', port))
|
||||||
|
|
||||||
items.extend(
|
items.extend(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user