This project is archived and is in readonly mode.

#191 ✓resolved
Oleg Anashkin

Add __repr__ to Json object for better logging

Reported by Oleg Anashkin | February 3rd, 2014 @ 04:19 AM

Currently, attempt to log or print Json object uses default python's implementation which is useless. Using actual serialized content is much better.

I have sent a pull request on github with the proposed change: https://github.com/psycopg/psycopg2/pull/9

Comments and changes to this ticket

  • Daniele Varrazzo

    Daniele Varrazzo February 3rd, 2014 @ 11:26 PM

    • State changed from “new” to “open”

    As per discussion on github, Json.__str__ should return getquoted() as many adapters already do. Also note:

    1) other adapters should be checked too (range?)
    2) are we returning the right types in py3 (bytes/str)?

  • Daniele Varrazzo

    Daniele Varrazzo February 22nd, 2014 @ 08:48 PM

    • State changed from “open” to “resolved”

    Pushed a str implementation for Json in my master. repr won't change.

    I'm not planning to release the change in 2.5 as it may change the programs behaviour in a radical way: the idea is to release it in 2.6.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<b>WARNING:</b> the informations in this tracker are archived. Please submit new tickets or comments to <a href="https://github.com/psycopg/psycopg2/issues">the new tracker</a>.
<br/>
Psycopg is the most used PostgreSQL adapter for the Python programming language. At the core it fully implements the Python DB API 2.0 specifications. Several extensions allow access to many of the features offered by PostgreSQL.

Shared Ticket Bins

Pages