summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/engine
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2010-02-25 22:00:58 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2010-02-25 22:00:58 +0000
commit756370e0b43a20ae30ed03cb30762756c97fb258 (patch)
treeb7a77d9c63db47d55d27dbebe3df7f45c38c0126 /lib/sqlalchemy/engine
parent8056006f067f98cffcbdc274a1c7921f00a67ab9 (diff)
downloadsqlalchemy-756370e0b43a20ae30ed03cb30762756c97fb258.tar.gz
- The assert_unicode flag is deprecated. SQLAlchemy will raise
a warning in all cases where it is asked to encode a non-unicode Python string, and will do nothing for DBAPIs that already accept Python unicode objects.
Diffstat (limited to 'lib/sqlalchemy/engine')
-rw-r--r--lib/sqlalchemy/engine/__init__.py12
-rw-r--r--lib/sqlalchemy/engine/default.py9
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/sqlalchemy/engine/__init__.py b/lib/sqlalchemy/engine/__init__.py
index d04907db8..137218c2c 100644
--- a/lib/sqlalchemy/engine/__init__.py
+++ b/lib/sqlalchemy/engine/__init__.py
@@ -119,12 +119,12 @@ def create_engine(*args, **kwargs):
are unique to that dialect. Here, we describe the parameters
that are common to most ``create_engine()`` usage.
- :param assert_unicode=False: When set to ``True`` alongside
- convert_unicode=``True``, asserts that incoming string bind
- parameters are instances of ``unicode``, otherwise raises an
- error. Only takes effect when ``convert_unicode==True``. This
- flag is also available on the ``String`` type and its
- descendants. New in 0.4.2.
+ :param assert_unicode: Deprecated. A warning is raised in all cases when a non-Unicode
+ object is passed when SQLAlchemy would coerce into an encoding
+ (note: but **not** when the DBAPI handles unicode objects natively).
+ To suppress or raise this warning to an
+ error, use the Python warnings filter documented at:
+ http://docs.python.org/library/warnings.html
:param connect_args: a dictionary of options which will be
passed directly to the DBAPI's ``connect()`` method as
diff --git a/lib/sqlalchemy/engine/default.py b/lib/sqlalchemy/engine/default.py
index 44c968942..5499b34e7 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -78,7 +78,14 @@ class DefaultDialect(base.Dialect):
"The %s dialect is not yet ported to SQLAlchemy 0.6" % self.name)
self.convert_unicode = convert_unicode
- self.assert_unicode = assert_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