mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-22 08:56:34 +03:00
parent
455f51c36c
commit
44d8edfd8c
7
NEWS
7
NEWS
|
@ -1,6 +1,13 @@
|
||||||
Current release
|
Current release
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
What's new in psycopg 2.7.1
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
- Ignore `!None` arguments passed to `~psycopg2.connect()` and
|
||||||
|
`~psycopg2.extensions.make_dsn()` (:ticket:`#517`).
|
||||||
|
|
||||||
|
|
||||||
What's new in psycopg 2.7
|
What's new in psycopg 2.7
|
||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
|
|
|
@ -162,6 +162,9 @@ def make_dsn(dsn=None, **kwargs):
|
||||||
"you can't specify both 'database' and 'dbname' arguments")
|
"you can't specify both 'database' and 'dbname' arguments")
|
||||||
kwargs['dbname'] = kwargs.pop('database')
|
kwargs['dbname'] = kwargs.pop('database')
|
||||||
|
|
||||||
|
# Drop the None arguments
|
||||||
|
kwargs = dict((k, v) for (k, v) in kwargs.iteritems() if v is not None)
|
||||||
|
|
||||||
if dsn is not None:
|
if dsn is not None:
|
||||||
tmp = parse_dsn(dsn)
|
tmp = parse_dsn(dsn)
|
||||||
tmp.update(kwargs)
|
tmp.update(kwargs)
|
||||||
|
|
|
@ -459,6 +459,10 @@ class MakeDsnTestCase(ConnectingTestCase):
|
||||||
dsn = ext.make_dsn(dsnin)
|
dsn = ext.make_dsn(dsnin)
|
||||||
self.assertEqual(dsn, dsnin)
|
self.assertEqual(dsn, dsnin)
|
||||||
|
|
||||||
|
def test_null_args(self):
|
||||||
|
dsn = ext.make_dsn("dbname=foo", user="bar", password=None)
|
||||||
|
self.assertDsnEqual(dsn, "dbname=foo user=bar")
|
||||||
|
|
||||||
@skip_before_libpq(9, 2)
|
@skip_before_libpq(9, 2)
|
||||||
def test_url_is_cool(self):
|
def test_url_is_cool(self):
|
||||||
url = 'postgresql://tester:secret@/test?application_name=wat'
|
url = 'postgresql://tester:secret@/test?application_name=wat'
|
||||||
|
|
Loading…
Reference in New Issue
Block a user