Re: psycopg2 gets confused by % characters and strict pyformat mode

Federico Di Gregorio <fog-NGVKUo/i/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Organization initd.org
Message-ID <[email protected]>
Il giorno gio, 11/09/2008 alle 11.34 +1000, Alejandro Dubrovsky ha scritto:
> > Isn't that likely to break existing applications that depend on the
> > current behaviour?  From what I can see, the current behaviour when
> > parameters are passed matches the DB-API specification.
> > 
> > It is debatable whether the behaviour when no parameters are passed is
> > correct (should it parse the '%' signs in that case?), but this
> > proposal seem to move things further away.
> > 
> 
> My suggestion was to have a settable mode whereby strings like '%s' are
> ignored, and only %(these)s are taken into account.
> eg
> pyscopg2.paramstylestrict = True
> 
> Default behaviour would remain unchanged.

I'd make it a .strictparamstyle attribute that can be se to "format" or
"pyformat" to select a single behaviour. Setting it to None (the
default) would just make psycopg behave as it currently does.

-- 
Federico Di Gregorio                         http://people.initd.org/fog
Debian GNU/Linux Developer                                [email protected]
INIT.D Developer                                           fog-NGVKUo/i/[email protected]
             A short story: I want you. I love you. I'll miss you. -- Me

_______________________________________________
Psycopg mailing list
Psycopg-IAPFreCvJWPBWskQ1e/[email protected]
http://lists.initd.org/mailman/listinfo/psycopg
signature.asc (application/pgp-signature, 197 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEABECAAYFAkjIzUYACgkQvcCgrgZGjetZ/ACeIQaqg/MhQoR71KdPq1hFtf+r
uLoAoLgdyAGxgcKFbhAmHFqyHHX7WVUc
=1x1W
-----END PGP SIGNATURE-----
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.