diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-09-12 20:28:10 +0000 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2009-09-12 20:28:10 +0000 |
| commit | 75848ce2c82626707fbb1329c7197637579c0b95 (patch) | |
| tree | fde599ee6f9e4982486e14a2058e0c8d804c264c /lib | |
| parent | f83c9a3959e25e5817bae6f0ca0015f9054baf8d (diff) | |
| download | sqlalchemy-75848ce2c82626707fbb1329c7197637579c0b95.tar.gz | |
- Table objects declared in the MetaData can now be used
in string expressions sent to primaryjoin/secondaryjoin/
secondary - the name is pulled from the MetaData of the
declarative base. [ticket:1527]
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/sqlalchemy/ext/declarative.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/sqlalchemy/ext/declarative.py b/lib/sqlalchemy/ext/declarative.py index c37211ac3..80faea36b 100644 --- a/lib/sqlalchemy/ext/declarative.py +++ b/lib/sqlalchemy/ext/declarative.py @@ -600,9 +600,11 @@ def _deferred_relation(cls, prop): import sqlalchemy def access_cls(key): - try: + if key in cls._decl_class_registry: return _GetColumns(cls._decl_class_registry[key]) - except KeyError: + elif key in cls.metadata.tables: + return cls.metadata.tables[key] + else: return sqlalchemy.__dict__[key] d = util.PopulateDict(access_cls) |
