From: Jeff Dairiki Date: Sun, 1 Sep 2013 09:33:50 +0000 (-0700) Subject: The str.encode() method does not accept keyword args in python < 2.7 X-Git-Tag: rel_0_6_1~30^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b33c38b35fe543874e02abf4a8c7738692246eb9;p=thirdparty%2Fsqlalchemy%2Falembic.git The str.encode() method does not accept keyword args in python < 2.7 --- diff --git a/alembic/util.py b/alembic/util.py index bd2f0358..a8750a2c 100644 --- a/alembic/util.py +++ b/alembic/util.py @@ -127,7 +127,7 @@ def write_outstream(stream, *text): encoding = getattr(stream, 'encoding', 'ascii') or 'ascii' for t in text: if not isinstance(t, binary_type): - t = t.encode(encoding, errors='replace') + t = t.encode(encoding, 'replace') t = t.decode(encoding) stream.write(t) diff --git a/tests/test_command.py b/tests/test_command.py index 1179b6e0..53a95386 100644 --- a/tests/test_command.py +++ b/tests/test_command.py @@ -26,11 +26,11 @@ class StdoutCommandTest(unittest.TestCase): # test default encode/decode behavior as well, # rev B has a non-ascii char in it + a coding header. eq_( - buf.getvalue().decode("ascii", errors='replace').strip(), + buf.getvalue().decode("ascii", 'replace').strip(), "\n".join([ script.get_revision(rev).log_entry for rev in expected - ]).encode("ascii", errors="replace").decode("ascii").strip() + ]).encode("ascii", "replace").decode("ascii").strip() ) def _buf_fixture(self):