Cal Leeming <cal.leem...@simplicitymedialtd.co.uk> added the comment:
Sorry, I should clarify.. The str() patch worked, but it failed to work within the realm of urllib2: s = _str("Content-MD5") print "Builtin:" print "plain: %s" % ( s ) print "capitalized: %s" % ( s.capitalize() ) s = str("Content-MD5") print "Builtin:" print "plain: %s" % ( s ) print "capitalized: %s" % ( s.capitalize() ) Builtin: plain: Content-MD5 capitalized: Content-MD5 Builtin: plain: Content-MD5 capitalized: Content-md5 Why it works in the unit test, and not within urllib2, is totally beyond me. Especially since I put a debug call on the method, and it does get called.. yet urllib2 debug still shows it sending the wrong value. --- capitalize() bypassed: sending value: Content-MD5 send: 'POST /api/url\r\nContent-Md5: nts0yj7AdzJALyNOxafDyA==\r\n\r\n' --- I have a feeling that the problem may lie somewhere after the opener (like HTTPConnection or AbstractHTTPHandler), rather than the urllib2 calls to capitalize(), but not having much luck monkey patching those :X ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue12455> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com