{"action":"opened","issue":{"url":"https://api.github.com/repos/django-oscar/django-oscar/issues/1868","labels_url":"https://api.github.com/repos/django-oscar/django-oscar/issues/1868/labels{/name}","comments_url":"https://api.github.com/repos/django-oscar/django-oscar/issues/1868/comments","events_url":"https://api.github.com/repos/django-oscar/django-oscar/issues/1868/events","html_url":"https://github.com/django-oscar/django-oscar/issues/1868","id":111210789,"number":1868,"title":"Basket Line Reference with already encoded utf-8 options","user":{"login":"jlmadurga","id":4689706,"avatar_url":"https://avatars.githubusercontent.com/u/4689706?v=3","gravatar_id":"","url":"https://api.github.com/users/jlmadurga","html_url":"https://github.com/jlmadurga","followers_url":"https://api.github.com/users/jlmadurga/followers","following_url":"https://api.github.com/users/jlmadurga/following{/other_user}","gists_url":"https://api.github.com/users/jlmadurga/gists{/gist_id}","starred_url":"https://api.github.com/users/jlmadurga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlmadurga/subscriptions","organizations_url":"https://api.github.com/users/jlmadurga/orgs","repos_url":"https://api.github.com/users/jlmadurga/repos","events_url":"https://api.github.com/users/jlmadurga/events{/privacy}","received_events_url":"https://api.github.com/users/jlmadurga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-13T15:54:29Z","updated_at":"2015-10-13T15:54:29Z","closed_at":null,"body":"In an ecommerce model with Options a Basket Line Reference is created by its options representation encoded as utf-8. It raises a problem when option value is already encoded in utf-8. \r\n\r\n```python\r\n    def _create_line_reference(self, product, stockrecord, options):\r\n        \"\"\"\r\n        Returns a reference string for a line based on the item\r\n        and its options.\r\n        \"\"\"\r\n        base = '%s_%s' % (product.id, stockrecord.id)\r\n        if not options:\r\n            return base\r\n        return \"%s_%s\" % (base, zlib.crc32(repr(options).encode('utf8')))\r\n```\r\n\r\nI imagine this encoding is done because only basket.AttributeLine value supported is charField. In extended models with more rich Attribute values it is a problem.\r\n\r\n"}}