Re: A list of open points in the documentation

Daniele Varrazzo <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Wed, Feb 10, 2010 at 8:03 AM, Federico Di Gregorio <fog-NGVKUo/i/[email protected]> wrote:
> On 10/02/2010 05:38, Daniele Varrazzo wrote:
Hi fog, thank you for the answers.

>> 4. in order to use the tuple adapter to the IN syntax,
>> psycopg2.extensions has to be imported. Is this a bug (it has already
>> bitten me once) to be fixed or a "feature" to document?
>
> It is a feature. Almost all extensions to the DBAPI (except ones in the
> C code) are enabled by importing psycopg2.extensions.

Works for me. I just wanted to point out that is pretty
counter-intuitive that, when you import the extensions module, the
SQL_IN gets immediately *registered* as a secondary effect, so the
module import effectively changes the behaviour of psycopg. All the
other exceptions are just imported and sit there waiting to be used.

But documentation is just for counter-intuitive points, isn't it? I
will add a note about that.


>> 6. The binary adapter is not imported in the psycopg2.extensions
>> module while all the other adapters seem there. Shall i add it too?
>
> I don't understand what you mean here?

"Binary", the adapter for binary buffers, is not imported in
psycopg2.extensions and only available from psycopg2._psycopg. All the
other adapters are imported instead. So, shall I commit this patch?

--- a/lib/extensions.py
+++ b/lib/extensions.py
@@ -31,7 +31,7 @@ from psycopg2._psycopg import DECIMALARRAY, FLOATARRAY, INTEGE
 from psycopg2._psycopg import LONGINTEGERARRAY, ROWIDARRAY, STRINGARRAY, TIMEAR
 from psycopg2._psycopg import UNICODEARRAY

-from psycopg2._psycopg import Boolean, Float, QuotedString, AsIs
+from psycopg2._psycopg import Boolean, Binary, Float, QuotedString, AsIs
 try:
     from psycopg2._psycopg import DateFromMx, TimeFromMx, TimestampFromMx
     from psycopg2._psycopg import IntervalFromMx


Thank you for all the answers, I'll fix the documentation later this afternoon.

-- Daniele
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.