SmileyChris / easy-thumbnails

Easy thumbnails for Django
http://easy-thumbnails.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1.39k stars 319 forks source link

'WSGIRequest' object has no attribute 'mode' #374

Closed linevych closed 9 years ago

linevych commented 9 years ago

I get this error when I include

'OPTIONS': {
            'context_processors': [
                'easy_thumbnails.processors.colorspace',
             ],
},
Environment:

Request Method: GET
Request URL: http://127.0.0.1:10801/uk/?edit&language=uk

Django Version: 1.8.3
Python Version: 3.4.0
Installed Applications:
('djangocms_admin_style',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'cmsplugin_cascade',
 'cmsplugin_cascade.extra_fields',
 'cmsplugin_cascade.sharable',
 'cms',
 'treebeard',
 'menus',
 'sekizai',
 'bootstrap3',
 'solo',
 'easy_thumbnails',
 'filer',
 'djangocms_inherit',
 'djangocms_picture',
 'djangocms_file',
 'djangocms_teaser',
 'djangocms_video',
 'djangocms_link',
 'djangocms_snippet',
 'djangocms_text_ckeditor'
)

Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'cms.middleware.language.LanguageCookieMiddleware')

Traceback:
File "/home/catalog_cms/.env/lib/python3.4/site-packages/django/core/handlers/base.py" in get_response
  164.                 response = response.render()
File "/home/catalog_cms/.env/lib/python3.4/site-packages/django/template/response.py" in render
  158.             self.content = self.rendered_content
File "/home/catalog_cms/.env/lib/python3.4/site-packages/django/template/response.py" in rendered_content
  135.         content = template.render(context, self._request)
File "/home/catalog_cms/.env/lib/python3.4/site-packages/django/template/backends/django.py" in render
  74.         return self.template.render(context)
File "/home/catalog_cms/.env/lib/python3.4/site-packages/django/template/base.py" in render
  208.                 with context.bind_template(self):
File "/usr/lib/python3.4/contextlib.py" in __enter__
  59.             return next(self.gen)
File "/home/catalog_cms/.env/lib/python3.4/site-packages/django/template/context.py" in bind_template
  241.             updates.update(processor(self.request))
File "/home/catalog_cms/.env/lib/python3.4/site-packages/easy_thumbnails/processors.py" in colorspace
  64.     if im.mode == 'I':

Exception Type: AttributeError at /uk/
Exception Value: 'WSGIRequest' object has no attribute 'mode'
linevych commented 9 years ago

I made a mistake, sorry. This is not context processors, but thumbnail processors. I just add:

THUMBNAIL_PROCESSORS = (
    'easy_thumbnails.processors.colorspace',
    'easy_thumbnails.processors.autocrop',
    'easy_thumbnails.processors.scale_and_crop',
    'easy_thumbnails.processors.filters',
    'easy_thumbnails.processors.background',
    'filer.thumbnail_processors.scale_and_crop_with_subject_location',
)

Now all working.