From 169637649baa012a8a77b17465c5c0c1085336ea Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Thu, 29 Aug 2013 08:35:17 +0200 Subject: [PATCH] Fixed #20984 -- Stopped decoding bytes in sqlite3 adapter on Python 3 Thanks lvella at gmail.com for the report. --- django/db/backends/sqlite3/base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py index 841ca92f3e..c6cda55229 100644 --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -84,8 +84,9 @@ Database.register_converter(str("decimal"), decoder(util.typecast_decimal)) Database.register_adapter(datetime.datetime, adapt_datetime_with_timezone_support) Database.register_adapter(decimal.Decimal, util.rev_typecast_decimal) -Database.register_adapter(str, lambda s: s.decode('utf-8')) -Database.register_adapter(SafeBytes, lambda s: s.decode('utf-8')) +if not six.PY3: + Database.register_adapter(str, lambda s: s.decode('utf-8')) + Database.register_adapter(SafeBytes, lambda s: s.decode('utf-8')) class DatabaseFeatures(BaseDatabaseFeatures):