From 193758ff9cc4d8e91979acf7f7b033de79b0cc0d Mon Sep 17 00:00:00 2001 From: Bertrand Bordage Date: Mon, 9 Mar 2015 20:36:53 +0100 Subject: [PATCH] Fixes unicode table names support on Python 2. --- cachalot/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cachalot/utils.py b/cachalot/utils.py index 0d83df9..a184ffe 100644 --- a/cachalot/utils.py +++ b/cachalot/utils.py @@ -55,11 +55,11 @@ def get_table_cache_key(db_alias, table): :return: A cache key :rtype: str """ - cache_key = ('%s:%s' % (db_alias, table)).encode('utf-8') + cache_key = ('%s:%s' % (db_alias, table)) # We check if we have to hash the key since it should nearly never be # necessary. if len(cache_key) > MAX_CACHE_KEY_LENGTH: - return sha1(cache_key).hexdigest() + return sha1(cache_key.encode('utf-8')).hexdigest() return cache_key