diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-07-09 16:33:38 +0000 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2008-07-09 16:33:38 +0000 |
commit | ff9c5007a87c830fb763b43b451db3e4f002c31f (patch) | |
tree | 50758c6031e5bd8004540f8b88708ddcb37178a2 | |
parent | e7e60c05c0dc5f6ee7f51a829c2e0635a26d95af (diff) | |
download | sqlalchemy-ff9c5007a87c830fb763b43b451db3e4f002c31f.tar.gz |
- Unicode, UnicodeText types now set "assert_unicode" and
"convert_unicode" by default, but accept overriding
**kwargs for these values.
-rw-r--r-- | CHANGES | 4 | ||||
-rw-r--r-- | lib/sqlalchemy/types.py | 8 |
2 files changed, 8 insertions, 4 deletions
@@ -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 bae079e64..6b6337754 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): |