From cec904367c6f2c81694801eb3ff1a634b2434d55 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Wed, 30 Jan 2019 10:20:41 +0100 Subject: Tests: fix warehouse division creation test --- ishtar_common/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'ishtar_common/utils.py') diff --git a/ishtar_common/utils.py b/ishtar_common/utils.py index 3e05ff6eb..1d44026e0 100644 --- a/ishtar_common/utils.py +++ b/ishtar_common/utils.py @@ -1032,9 +1032,11 @@ def rename_and_simplify_media_name(full_path_name, rename=True): :return: new full path name (or old if not changed), modified """ try: + is_str = False exists = os.path.exists(full_path_name) is_file = os.path.isfile(full_path_name) except UnicodeEncodeError: + is_str = True full_path_name = full_path_name.encode('utf-8') exists = os.path.exists(full_path_name) is_file = os.path.isfile(full_path_name) @@ -1043,6 +1045,10 @@ def rename_and_simplify_media_name(full_path_name, rename=True): path, current_name, name = simplify_name(full_path_name, check_existing=True) + if is_str: + full_path_name = full_path_name.decode('utf-8') + name = name.decode('utf-8') + path = path.decode('utf-8') if current_name == name: return full_path_name, False -- cgit v1.2.3