diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-04 14:28:57 -0500 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2011-12-04 14:28:57 -0500 |
commit | 7f68a3a52729ff9b3eee0939292415fd81d61443 (patch) | |
tree | 0f8484473f9d66bfacb6d1dfe18c97756d639676 /lib/sqlalchemy/ext/declarative.py | |
parent | 632043bc8a72651f497396eb17e6f2b19bf98608 (diff) | |
download | sqlalchemy-7f68a3a52729ff9b3eee0939292415fd81d61443.tar.gz |
- [bug] __table_args__ can now be passed as
an empty tuple as well as an empty dict.
[ticket:2339]. Thanks to Fayaz Yusuf Khan
for the patch.
Diffstat (limited to 'lib/sqlalchemy/ext/declarative.py')
-rwxr-xr-x | lib/sqlalchemy/ext/declarative.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index 1f082adf1..ffbdfaae9 100755 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -1153,15 +1153,15 @@ def _as_declarative(cls, classname, dict_): if '__table__' not in dict_: if tablename is not None: - if isinstance(table_args, dict): - args, table_kw = (), table_args - elif isinstance(table_args, tuple): - if isinstance(table_args[-1], dict): - args, table_kw = table_args[0:-1], table_args[-1] - else: - args, table_kw = table_args, {} - else: - args, table_kw = (), {} + args, table_kw = (), {} + if table_args: + if isinstance(table_args, dict): + table_kw = table_args + elif isinstance(table_args, tuple): + if isinstance(table_args[-1], dict): + args, table_kw = table_args[0:-1], table_args[-1] + else: + args = table_args autoload = dict_.get('__autoload__') if autoload: |