Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

psycopg2.connect fails when using spaces in password-keyword

#87

Hi all,

Psycopg2 fails when trying to authenticate with spaces in a password. The following code illustrates the problem:

>>> import psycopg2
>>> psycopg2.connect(database='amcat', host='localhost', user='martijn', port='5433', password='foo baar') 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
psycopg2.OperationalError: missing "=" after "test" in connection info string

I've submitted a very simple patch, which resolves the problem, but introduces another problem: the object returned shows part of the password.

>>> psycopg2.connect(**params)
<connection object at 0x2449710; dsn: 'dbname=amcat host=localhost port=5433 user=martijn password=xxxxx baar', closed: 0>

I'm unable to locate the relevant lines. If anyone could point me in the right direction, I'd be more than happy to fix the that part too.

Kind regards,
Martijn

Reported by Martijn Bastiaan · January 2nd, 2012 @ 10:31 PM

State: resolved
Milestone: none
Assigned to: nobody

Activity

  1. Martijn Bastiaan
    Martijn Bastiaan

    Never mind, this problem is solved in trunk.

    January 2nd, 2012 @ 10:48 PM

  2. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to resolved

    Yup: fixed in 2.4.3.

    January 9th, 2012 @ 12:19 PM