[Zope3-checkins] CVS: Products3/pypgsqlda - adapter.py:1.2
Christian Theune
ct@gocept.com
Mon, 17 Mar 2003 12:37:42 -0500
Update of /cvs-repository/Products3/pypgsqlda
In directory cvs.zope.org:/tmp/cvs-serv2043
Modified Files:
adapter.py
Log Message:
- activated unicode compatibility
- paying respect to "client_encoding" parameter
=== Products3/pypgsqlda/adapter.py 1.1.1.1 => 1.2 ===
--- Products3/pypgsqlda/adapter.py:1.1.1.1 Mon Mar 17 12:17:18 2003
+++ Products3/pypgsqlda/adapter.py Mon Mar 17 12:37:41 2003
@@ -28,9 +28,18 @@
def _connection_factory(self):
"""Create a pypgsql DBI connection based on the DSN"""
conn_info = parseDSN(self.dsn)
+ params = conn_info['parameters']
+
+ # XXX ADd options and port
+ if params.has_key('client_encoding'):
+ client_encoding = params['client_encoding']
+ else:
+ client_encoding = 'ISO-8859-1' # XXX where do i get the system default?
- # XXX ADd unicode_results, client_encoding, options and port
-
- return PgSQL.connect(user=conn_info['username'],password=conn_info['password'],
- database=conn_info['dbname'], host=conn_info['host'])
+ return PgSQL.connect(user=conn_info['username'],
+ password=conn_info['password'],
+ database=conn_info['dbname'],
+ host=conn_info['host'],
+ unicode_results=1,
+ client_encoding=client_encoding)