[Zope] Telling Psycopgda2 to return unicode strings
Andreas Elvers
andreas at work.de
Thu Jul 26 08:10:55 EDT 2007
Hi,
I don't know if this is common knowledge, but I couldn't find anything
about it on the web. So I hacked it myself.
When querying a Postgresql database using unicode in Zope 2.10 via
ZPsycopgda2, the adapter will return unicode data in plain strings. To
force unicode strings to be returned go to your Products folder and
create a directory like ZPsycopgda2SetUnicode.
In this directory put an __init__.py file containing this code:
import psycopg2
import psycopg2.extensions
psycopg2.extensions.register_type(psycopg2.extensions.UNICODE)
After this restart Zope. ZPsycopgda2 should now return unicode strings.
- Andreas
More information about the Zope
mailing list