Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DjangoUnicodeDecodeError when saving product with variations (in admin) #112

Closed
stargazer33 opened this issue May 31, 2013 · 2 comments
Closed
Labels

Comments

@stargazer33
Copy link

I created completely localized website in russian, so everything is in russian including product names, product variations and the SHOP_OPTION_TYPE_CHOICES

I entered the following in settings.py:

SHOP_OPTION_TYPE_CHOICES = (
(1, "Размер"),
(2, "Материал"),
)

Everything works fine until I try to create new variations and save the product with new variations in the admin. I press "save" and get DjangoUnicodeDecodeError.
So, somewhere there should be a bug. Hope the traceback below will be enough to indentify it.

Environment:


Request Method: POST
Request URL: http://localhost:8000/admin/shop/product/9/

Django Version: 1.5.1
Python Version: 2.7.3
Installed Applications:
('mezzanine.boot',
 'theme1',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.redirects',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.sitemaps',
 'django.contrib.staticfiles',
 'cartridge.shop',
 'mezzanine.conf',
 'mezzanine.core',
 'mezzanine.generic',
 'mezzanine.blog',
 'mezzanine.forms',
 'mezzanine.pages',
 'mezzanine.galleries',
 'mezzanine.accounts',
 'filebrowser_safe',
 'grappelli_safe',
 'django.contrib.admin',
 'django.contrib.comments')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.redirects.middleware.RedirectFallbackMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'cartridge.shop.middleware.ShopMiddleware',
 'mezzanine.core.request.CurrentRequestMiddleware',
 'mezzanine.core.middleware.TemplateForDeviceMiddleware',
 'mezzanine.core.middleware.TemplateForHostMiddleware',
 'mezzanine.core.middleware.AdminLoginInterfaceSelectorMiddleware',
 'mezzanine.core.middleware.SitePermissionMiddleware',
 'mezzanine.pages.middleware.PageMiddleware')


Traceback:
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  115.                         response = callback(request, *callback_args, **callback_kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  372.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  202.             return view(request, *args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/db/transaction.py" in inner
  223.                 return func(*args, **kwargs)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in change_view
  1107.                 change_message = self.construct_change_message(request, form, formsets)
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/contrib/admin/options.py" in construct_change_message
  696.                                              'object': force_text(changed_object)})
File "/home/dima/.virtualenvs/prj_inox/local/lib/python2.7/site-packages/django/utils/encoding.py" in force_text
  115.             raise DjangoUnicodeDecodeError(s, *e.args)

Exception Type: DjangoUnicodeDecodeError at /admin/shop/product/9/
Exception Value: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128). You passed in  ()

@stephenmcd
Copy link
Owner

Thanks a lot for the report - please give this fix a try, it should resolve it.

@stargazer33
Copy link
Author

yes, it resolves the problem! Well done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants