diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-10-15 11:43:59 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-10-15 11:43:59 -0400 |
commit | 35508a30d7f0e92bd699da375316c75d9d6dd8dc (patch) | |
tree | 7c23b4a5043ea6d5bbe95b9bc6692b0a8996a119 /lib/sqlalchemy/util.py | |
parent | b47983f8ecdc022c42d2c3b624894e58b4f18538 (diff) | |
download | sqlalchemy-35508a30d7f0e92bd699da375316c75d9d6dd8dc.tar.gz |
- engine_from_config() now accepts 'debug' for
'echo', 'echo_pool', 'force' for 'convert_unicode',
boolean values for 'use_native_unicode'.
[ticket:1899]
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r-- | lib/sqlalchemy/util.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index 21026d53c..922d5bee5 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -584,6 +584,18 @@ def asbool(obj): raise ValueError("String is not true/false: %r" % obj) return bool(obj) +def bool_or_str(*text): + """Return a callable that will evaulate a string as + boolean, or one of a set of "alternate" string values. + + """ + def bool_or_value(obj): + if obj in text: + return obj + else: + return asbool(obj) + return bool_or_value + def coerce_kw_type(kw, key, type_, flexi_bool=True): """If 'key' is present in dict 'kw', coerce its value to type 'type\_' if necessary. If 'flexi_bool' is True, the string '0' is considered false |