diff --git a/wcs/qommon/storage.py b/wcs/qommon/storage.py index dc2e6a4af..5670f5361 100644 --- a/wcs/qommon/storage.py +++ b/wcs/qommon/storage.py @@ -25,6 +25,7 @@ import sys import tempfile from django.utils import six +from django.utils.encoding import force_bytes from django.utils.six.moves import _thread from .vendor import locket @@ -310,7 +311,7 @@ class StorableObject(object): @classmethod def has_key(cls, id): filename = os.path.join(cls.get_objects_dir(), fix_key(id)) - return os.path.exists(filename) + return os.path.exists(force_bytes(filename, 'utf-8')) @classmethod def get_new_id(cls, create=False): @@ -400,7 +401,7 @@ class StorableObject(object): @classmethod def get_filename(cls, filename, ignore_errors=False, ignore_migration=False, **kwargs): try: - fd = open(filename, 'rb') + fd = open(force_bytes(filename, 'utf-8'), 'rb') o = cls.storage_load(fd, **kwargs) except IOError: if ignore_errors: