diff options
| author | Jason Kirtland <jek@discorporate.us> | 2008-03-15 23:13:35 +0000 |
|---|---|---|
| committer | Jason Kirtland <jek@discorporate.us> | 2008-03-15 23:13:35 +0000 |
| commit | 9e15993083c9213fd900e6d92c571367c6b6e1ae (patch) | |
| tree | 2a29b575bc2335d581c64a1ee01024a35c9ba465 /lib/sqlalchemy/ext/declarative.py | |
| parent | 288f9d53e37853825652074fcd5d1063f5c8992f (diff) | |
| download | sqlalchemy-9e15993083c9213fd900e6d92c571367c6b6e1ae.tar.gz | |
Issue a warning when a declarative detects a likely trailing comma: foo = Column(foo),
Diffstat (limited to 'lib/sqlalchemy/ext/declarative.py')
| -rw-r--r-- | lib/sqlalchemy/ext/declarative.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index 4feb47456..41a51c8c6 100644 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -159,6 +159,12 @@ class DeclarativeMeta(type): our_stuff = {} for k in dict_: value = dict_[k] + if (isinstance(value, tuple) and len(value) == 1 and + isinstance(value[0], (Column, MapperProperty))): + util.warn("Ignoring declarative-like tuple value of attribute " + "%s: possibly a copy-and-paste error with a comma " + "left at the end of the line?" % k) + continue if not isinstance(value, (Column, MapperProperty)): continue prop = _deferred_relation(cls, value) |
