[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: UTF-8 problem in db/dak interaction



Hi,

there seems to be already a workaround for Unicode issues in
daklib/dbconn.py, but it is only used with sqlalchemy 0.6. Could you try
the attached patch?

A better workaround might be setting client_encoding[1], but I am not
sure what ends in the database. However maybe we should just require
that the database uses the UTF-8 encoding instead of an unspecified one.

  [1] <http://docs.sqlalchemy.org/en/rel_0_7/dialects/postgresql.html#unicode>

Ansgar
>From eee348c6e11ec216b3c4c4c9c0942fde141ad24e Mon Sep 17 00:00:00 2001
From: Ansgar Burchardt <ansgar@debian.org>
Date: Tue, 20 Nov 2012 15:51:31 +0100
Subject: [PATCH] daklib/dbconn.py: use unicode workaround also for sqlalchemy
 0.7

---
 daklib/dbconn.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/daklib/dbconn.py b/daklib/dbconn.py
index f2f8a90..413a0fd 100644
--- a/daklib/dbconn.py
+++ b/daklib/dbconn.py
@@ -2892,7 +2892,7 @@ class DBConn(object):
             engine_args['pool_size'] = int(cnf['DB::PoolSize'])
         if cnf.has_key('DB::MaxOverflow'):
             engine_args['max_overflow'] = int(cnf['DB::MaxOverflow'])
-        if sa_major_version == '0.6' and cnf.has_key('DB::Unicode') and \
+        if sa_major_version in ('0.6', '0.7') and cnf.has_key('DB::Unicode') and \
             cnf['DB::Unicode'] == 'false':
             engine_args['use_native_unicode'] = False
 
-- 
1.7.9.5


Reply to: