From: Mike Bayer Date: Wed, 9 Jul 2008 16:33:38 +0000 (+0000) Subject: - Unicode, UnicodeText types now set "assert_unicode" and X-Git-Tag: rel_0_5beta2~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff9c5007a87c830fb763b43b451db3e4f002c31f;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Unicode, UnicodeText types now set "assert_unicode" and "convert_unicode" by default, but accept overriding **kwargs for these values. --- diff --git a/CHANGES b/CHANGES index 68ac6ff893..8d83e79168 100644 --- a/CHANGES +++ b/CHANGES @@ -49,6 +49,10 @@ CHANGES strings to insert after CREATE in the CREATE TABLE statement. [ticket:1075] + - Unicode, UnicodeText types now set "assert_unicode" and + "convert_unicode" by default, but accept overriding + **kwargs for these values. + - sqlite - Modified SQLite's representation of "microseconds" to match the output of str(somedatetime), i.e. in that the diff --git a/lib/sqlalchemy/types.py b/lib/sqlalchemy/types.py index bae079e649..6b63377545 100644 --- a/lib/sqlalchemy/types.py +++ b/lib/sqlalchemy/types.py @@ -423,16 +423,16 @@ class Unicode(String): """A synonym for String(length, convert_unicode=True, assert_unicode='warn').""" def __init__(self, length=None, **kwargs): - kwargs['convert_unicode'] = True - kwargs['assert_unicode'] = 'warn' + kwargs.setdefault('convert_unicode', True) + kwargs.setdefault('assert_unicode', 'warn') super(Unicode, self).__init__(length=length, **kwargs) class UnicodeText(Text): """A synonym for Text(convert_unicode=True, assert_unicode='warn').""" def __init__(self, length=None, **kwargs): - kwargs['convert_unicode'] = True - kwargs['assert_unicode'] = 'warn' + kwargs.setdefault('convert_unicode', True) + kwargs.setdefault('assert_unicode', 'warn') super(UnicodeText, self).__init__(length=length, **kwargs) class Integer(TypeEngine):