ERP5TypeTestCase: stop copying ZopeTestCase's publish implementation
Call the original method instead of copy/pasting the code The original method will use .encode() on the basic= argument, so it needs to be an ascii str or an unicode on python2, we had to change some callers to pass basic= as text, to prevent: File "eggs/Zope-4.5.3+slapospatched001-py2.7.egg/Testing/ZopeTestCase/functional.py", line 43, in wrapped_func return func(*args, **kw) File "eggs/Zope-4.5.3+slapospatched001-py2.7.egg/Testing/ZopeTestCase/functional.py", line 93, in publish env['HTTP_AUTHORIZATION'] = basic_auth_encode(basic) File "eggs/Zope-4.5.3+slapospatched001-py2.7.egg/ZPublisher/utils.py", line 91, in basic_auth_encode header = b'Basic ' + base64.b64encode(value.encode('latin-1')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
Showing
-
Owner
Ah the commit message is outdated, all this part:
The original method will use .encode() on the basic= argument, so it needs to be an ascii str or an unicode on python2, we had to change some callers to pass basic= as text, to prevent: File "eggs/Zope-4.5.3+slapospatched001-py2.7.egg/Testing/ZopeTestCase/functional.py", line 43, in wrapped_func return func(*args, **kw) File "eggs/Zope-4.5.3+slapospatched001-py2.7.egg/Testing/ZopeTestCase/functional.py", line 93, in publish env['HTTP_AUTHORIZATION'] = basic_auth_encode(basic) File "eggs/Zope-4.5.3+slapospatched001-py2.7.egg/ZPublisher/utils.py", line 91, in basic_auth_encode header = b'Basic ' + base64.b64encode(value.encode('latin-1')) UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2: ordinal not in range(128)
should be removed, this was actually a problem in Zope but we fixed it in Zope
Please register or sign in to comment