{"action":"created","issue":{"url":"https://api.github.com/repos/mitsuhiko/werkzeug/issues/783","labels_url":"https://api.github.com/repos/mitsuhiko/werkzeug/issues/783/labels{/name}","comments_url":"https://api.github.com/repos/mitsuhiko/werkzeug/issues/783/comments","events_url":"https://api.github.com/repos/mitsuhiko/werkzeug/issues/783/events","html_url":"https://github.com/mitsuhiko/werkzeug/issues/783","id":111860922,"number":783,"title":"_compat.to_bytes does not allow for class instances that implement __str__ or __unicode__","user":{"login":"frostiebot","id":1655689,"avatar_url":"https://avatars.githubusercontent.com/u/1655689?v=3","gravatar_id":"","url":"https://api.github.com/users/frostiebot","html_url":"https://github.com/frostiebot","followers_url":"https://api.github.com/users/frostiebot/followers","following_url":"https://api.github.com/users/frostiebot/following{/other_user}","gists_url":"https://api.github.com/users/frostiebot/gists{/gist_id}","starred_url":"https://api.github.com/users/frostiebot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/frostiebot/subscriptions","organizations_url":"https://api.github.com/users/frostiebot/orgs","repos_url":"https://api.github.com/users/frostiebot/repos","events_url":"https://api.github.com/users/frostiebot/events{/privacy}","received_events_url":"https://api.github.com/users/frostiebot/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-16T16:02:35Z","updated_at":"2015-11-10T22:24:03Z","closed_at":"2015-11-10T22:24:03Z","body":"Somewhat related to #436 - I recently came across an issue with set_cookie when I upgraded a package with pip and it rudely upgraded my copy of werkzeug from 0.8.3 to 0.10.4 under Python 2.7.9.\r\n\r\nBasically, I was passing an instance of uuid.UUID as the value argument to set_cookie, and there was no problem. After the update, I received a TypeError.\r\n\r\nSo back to #436 - When calling set_cookie, should I _always_ convert the intended value with str/unicode to begin with? It definitely makes sense to be strict for python primitive types, but I think n the case of a class that implements __str__ (or __unicode__) there should be some leeway given.\r\n\r\nI think the assumption that the value argument for set_cookie is that it will be converted to a string is a fair assumption for anyone using it to make - after all the documentation for the function makes no mention of any special requirements, in fact the parameter is described simply as \"value – the value of the cookie.\" - the only hint that it should be a string-like object is the function signature itself which shows the default for value to be an empty string."},"comment":{"url":"https://api.github.com/repos/mitsuhiko/werkzeug/issues/comments/155587150","html_url":"https://github.com/mitsuhiko/werkzeug/issues/783#issuecomment-155587150","issue_url":"https://api.github.com/repos/mitsuhiko/werkzeug/issues/783","id":155587150,"user":{"login":"mitsuhiko","id":7396,"avatar_url":"https://avatars.githubusercontent.com/u/7396?v=3","gravatar_id":"","url":"https://api.github.com/users/mitsuhiko","html_url":"https://github.com/mitsuhiko","followers_url":"https://api.github.com/users/mitsuhiko/followers","following_url":"https://api.github.com/users/mitsuhiko/following{/other_user}","gists_url":"https://api.github.com/users/mitsuhiko/gists{/gist_id}","starred_url":"https://api.github.com/users/mitsuhiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitsuhiko/subscriptions","organizations_url":"https://api.github.com/users/mitsuhiko/orgs","repos_url":"https://api.github.com/users/mitsuhiko/repos","events_url":"https://api.github.com/users/mitsuhiko/events{/privacy}","received_events_url":"https://api.github.com/users/mitsuhiko/received_events","type":"User","site_admin":false},"created_at":"2015-11-10T22:24:03Z","updated_at":"2015-11-10T22:24:03Z","body":"You need to explicitly convert it into a string. Every class implements `__str__` and `__unicode__`."}}