Move force_bytes into lib module

This commit is contained in:
Matthew Dapena-Tretter 2013-12-14 13:02:21 -05:00
parent c1e16696b1
commit 87983c5e6d
2 changed files with 8 additions and 9 deletions

View file

@ -41,10 +41,13 @@ except ImportError:
# It is used for compatibility between Python 2 and Python 3
# NOTE: I'm not sure if this is the right place. Maybe this can be in `utils`.
try:
from django.utils.encoding import force_text, smart_text
from django.utils.encoding import force_text, force_bytes, smart_text
except ImportError:
# Django < 1.5
from django.utils.encoding import force_unicode as force_text, smart_unicode as smart_text
from django.utils.encoding import (force_unicode as force_text,
smart_str as force_bytes,
smart_unicode as smart_text)
__all__ = ['Image', 'ImageColor', 'ImageChops', 'ImageEnhance', 'ImageFile', 'ImageFilter',
'ImageDraw', 'ImageStat', 'StringIO', 'NullHandler', 'force_text', 'smart_text']
__all__ = ['Image', 'ImageColor', 'ImageChops', 'ImageEnhance', 'ImageFile',
'ImageFilter', 'ImageDraw', 'ImageStat', 'StringIO', 'NullHandler',
'force_text', 'force_bytes', 'smart_text']

View file

@ -8,12 +8,8 @@ from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.utils.importlib import import_module
try:
from django.utils.encoding import force_bytes
except ImportError:
from django.utils.encoding import smart_str as force_bytes
from pilkit.utils import *
from .lib import NullHandler
from .lib import NullHandler, force_bytes
bad_memcached_key_chars = re.compile('[\u0000-\u001f\\s]+')