Issue 18012: cannot assign unicode keys to SimpleCookie (original) (raw)

from Cookie import SimpleCookie

cookie = SimpleCookie() cookie[u'apple'] = u'green' Traceback (most recent call last): File "", line 1, in File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 592, in setitem self.__set(key, rval, cval) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 585, in __set M.set(key, real_value, coded_value) File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/Cookie.py", line 459, in set if "" != translate(key, idmap, LegalChars): File "/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/python2.7/string.py", line 493, in translate return s.translate(table, deletions) TypeError: translate() takes exactly one argument (2 given)

The documentation don't say it's not supported. And the error TypeError seems not appropriate.