From: Mike Bayer Date: Mon, 14 Oct 2013 14:56:11 +0000 (-0400) Subject: workaround for #2838 here. still need to figure out why an ENUM test is suddenly... X-Git-Tag: rel_0_8_3~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5389bc5d8d6e72bdf7bf937de77201d6d2a58759;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git workaround for #2838 here. still need to figure out why an ENUM test is suddenly hitting this. --- diff --git a/lib/sqlalchemy/sql/compiler.py b/lib/sqlalchemy/sql/compiler.py index 0a1fcdfab1..d537536911 100644 --- a/lib/sqlalchemy/sql/compiler.py +++ b/lib/sqlalchemy/sql/compiler.py @@ -845,6 +845,13 @@ class SQLCompiler(engine.Compiled): return repr(value) elif isinstance(value, decimal.Decimal): return str(value) + elif isinstance(value, util.binary_type): + # only would occur on py3k b.c. on 2k the string_types + # directive above catches this. + # see #2838 + value = value.decode(self.dialect.encoding).replace("'", "''") + return "'%s'" % value + else: raise NotImplementedError( "Don't know how to literal-quote value %r" % value)