From: Mike Bayer Date: Thu, 25 Oct 2012 16:07:38 +0000 (-0400) Subject: The long-deprecated and non-functional ``assert_unicode`` flag on X-Git-Tag: rel_0_8_0b1~20 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c6bde1c15c97cae34ef9449aa595168910fe87d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git The long-deprecated and non-functional ``assert_unicode`` flag on :func:`.create_engine` as well as :class:`.String` is removed. --- diff --git a/doc/build/changelog/changelog_08.rst b/doc/build/changelog/changelog_08.rst index 999b2ebbce..5d06263f44 100644 --- a/doc/build/changelog/changelog_08.rst +++ b/doc/build/changelog/changelog_08.rst @@ -1361,3 +1361,8 @@ :meth:`.ColumnOperators.notlike`, :meth:`.ColumnOperators.notilike` to :class:`.ColumnOperators`. + .. change:: + :tags: sql, removed + + The long-deprecated and non-functional ``assert_unicode`` flag on + :func:`.create_engine` as well as :class:`.String` is removed. \ No newline at end of file diff --git a/lib/sqlalchemy/engine/__init__.py b/lib/sqlalchemy/engine/__init__.py index eb9ef266bd..3deb437bbf 100644 --- a/lib/sqlalchemy/engine/__init__.py +++ b/lib/sqlalchemy/engine/__init__.py @@ -126,12 +126,6 @@ def create_engine(*args, **kwargs): :ref:`connections_toplevel` - :param assert_unicode: Deprecated. This flag - sets an engine-wide default value for - the ``assert_unicode`` flag on the - :class:`.String` type - see that - type for further details. - :param case_sensitive=True: if False, result column names will match in a case-insensitive fashion, that is, ``row['SomeColumn']``. diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py index f43c0404e6..1be7bc0293 100644 --- a/lib/sqlalchemy/engine/default.py +++ b/lib/sqlalchemy/engine/default.py @@ -99,7 +99,7 @@ class DefaultDialect(interfaces.Dialect): reflection_options = () - def __init__(self, convert_unicode=False, assert_unicode=False, + def __init__(self, convert_unicode=False, encoding='utf-8', paramstyle=None, dbapi=None, implicit_returning=None, case_sensitive=True, @@ -111,16 +111,6 @@ class DefaultDialect(interfaces.Dialect): self.name) self.convert_unicode = convert_unicode - if assert_unicode: - util.warn_deprecated( - "assert_unicode is deprecated. " - "SQLAlchemy emits a warning in all cases where it " - "would otherwise like to encode a Python unicode object " - "into a specific encoding but a plain bytestring is " - "received. " - "This does *not* apply to DBAPIs that coerce Unicode " - "natively.") - self.encoding = encoding self.positional = False self._ischema = None diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index e31cecfe22..579bd354d5 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -982,7 +982,7 @@ class String(Concatenable, TypeEngine): def __init__(self, length=None, collation=None, convert_unicode=False, - assert_unicode=None, unicode_error=None, + unicode_error=None, _warn_on_bytestring=False ): """ @@ -1035,13 +1035,6 @@ class String(Concatenable, TypeEngine): cause SQLAlchemy's encode/decode services to be used unconditionally. - :param assert_unicode: Deprecated. A warning is emitted - when a non-``unicode`` object is passed to the - :class:`.Unicode` subtype of :class:`.String`, - or the :class:`.UnicodeText` subtype of :class:`.Text`. - See :class:`.Unicode` for information on how to - control this warning. - :param unicode_error: Optional, a method to use to handle Unicode conversion errors. Behaves like the ``errors`` keyword argument to the standard library's ``string.decode()`` functions. This flag @@ -1058,15 +1051,6 @@ class String(Concatenable, TypeEngine): raise exc.ArgumentError("convert_unicode must be 'force' " "when unicode_error is set.") - if assert_unicode: - util.warn_deprecated('assert_unicode is deprecated. ' - 'SQLAlchemy emits a warning in all ' - 'cases where it would otherwise like ' - 'to encode a Python unicode object ' - 'into a specific encoding but a plain ' - 'bytestring is received. This does ' - '*not* apply to DBAPIs that coerce ' - 'Unicode natively.') self.length = length self.collation = collation self.convert_unicode = convert_unicode diff --git a/test/perf/stress_all.py b/test/perf/stress_all.py index b5d210eefe..d17028530f 100644 --- a/test/perf/stress_all.py +++ b/test/perf/stress_all.py @@ -129,7 +129,7 @@ typedecoratortest = (MyIntType, genmyintvalue, # Unicode def genunicodevalue(rnum, fnum): return (rnum % 4) and (u"value%d" % fnum) or None -unicodetest = (Unicode(20, assert_unicode=False), genunicodevalue, +unicodetest = (Unicode(20, ), genunicodevalue, dict(num_records=100000)) # dict(engineurl='mysql:///test', freshdata=False)) @@ -159,7 +159,7 @@ if test_methods: for engineurl in ('postgresql://scott:tiger@localhost/test', 'sqlite://', 'mysql://scott:tiger@localhost/test'): print "\n%s\n" % engineurl - test_table = prepare(Unicode(20, assert_unicode=False), + test_table = prepare(Unicode(20,), genunicodevalue, num_fields=10, num_records=100000, verbose=verbose, engineurl=engineurl)