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

Fix char encoding error when setting shipping_type in session #182

Closed
wants to merge 1 commit into from

Conversation

jaywink
Copy link
Contributor

@jaywink jaywink commented Mar 1, 2014

On Finnish locale, translation for shipping type has non-ascii letters and thus saving order gave a DB error.

@stephenmcd
Copy link
Owner

Don't think that's the right fix for Python 3.

@jaywink
Copy link
Contributor Author

jaywink commented Mar 2, 2014

Yes you are right hmm. Of course reading the docs for future.builtins.str method this shouldn't even be a problem. I did a full compare with my fork and cartridge master and couldn't find anything. I then put a print vars(request.session) just after the utils.set_shipping method sets the values, and the following where you can clearly see the problem:

{'_session_cache': {u'tax_total': 0, '_auth_user_id': 1L, u'tax_type': 'Vero', u'shipping_total': 0,
u'cart': 6L, '_auth_user_backend': 'mezzanine.core.auth_backends.MezzanineBackend', 
u'shipping_type': 'Toimitus kiinte\xe4\xe4n hintaan', u'order': {'card_name': u'',
'shipping_detail_last_name': u'Robinson', 'remember': True, 'billing_detail_email': 
u'mail@remoded.real.email', 'shipping_detail_first_name': u'Jason', u'additional_instructions': 
u'', 'card_type': u'', 'step': 1, 'billing_detail_last_name': u'Robinson', 'billing_detail_phone': 
u'+358451234567', 'shipping_detail_phone': u'', 'same_billing_shipping': False, 
'billing_detail_first_name': u'Jason'}}, '_session_key': 'lco10q5tv7mgrpabogi76yvrp4v2brsw', 
'modified': True, 'serializer': <class 'django.contrib.sessions.serializers.PickleSerializer'>, 
'accessed': True}

My fork has from __future__ import unicode_literals and from future.builtins import str in utils.py when the problem happens.. Python is 2.7.5, future at 0.9.0..

@stephenmcd
Copy link
Owner

I'm able to set shipping/tax types with non-ascii chars and complete an order:

http://cl.ly/image/2I1943192b1Y

Suggest there's an issue elsewhere, please reply if you work it out.

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

Successfully merging this pull request may close these issues.

None yet

2 participants