diff roundup/backends/rdbms_common.py @ 6157:3c52093d7490

Fix string conversion from database The sql_to_hyperdb_value table would convert strings coming from the database using "str". This is now changed to "us2s", converting unicode strings coming from the database to utf-8. This happens only for python2, for python3 the database interface uses unicode (aka str in python3). This fixes the behaviour for mysql if utf8 encoding is chosen explicitly, it seems in that case the database interface returns values as python2 unicode objects.
author Ralf Schlatterbeck <rsc@runtux.com>
date Mon, 04 May 2020 16:49:07 +0200
parents ba0cfc1a87c9
children a701c9c81597
line wrap: on
line diff
--- a/roundup/backends/rdbms_common.py	Sat May 02 22:24:41 2020 +0200
+++ b/roundup/backends/rdbms_common.py	Mon May 04 16:49:07 2020 +0200
@@ -60,7 +60,6 @@
     Multilink, DatabaseError, Boolean, Number, Integer
 from roundup.i18n import _
 
-
 # support
 from roundup.backends.blobfiles import FileStorage
 from roundup.backends.indexer_common import get_indexer
@@ -1105,7 +1104,7 @@
                 self.sql(sql, [int(nodeid)] + remove)
 
     sql_to_hyperdb_value = {
-        hyperdb.String    : str,
+        hyperdb.String    : us2s,
         hyperdb.Date      : date_to_hyperdb_value,
 #        hyperdb.Link   : int,      # XXX numeric ids
         hyperdb.Link      : str,

Roundup Issue Tracker: http://roundup-tracker.org/