diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-05 14:56:26 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-12-05 14:56:26 -0500 |
| commit | f1e54a69fb9b07a73bd8488110b1ceace168a50a (patch) | |
| tree | 9ffef9bc95b2015877f5dcfa63fb6574a87ca15e /lib/sqlalchemy/util | |
| parent | 77763969ff06b12edcbaedab62890afa27e105b4 (diff) | |
| parent | 926b0d7fa860abee8b34236148fa34a6666700a9 (diff) | |
| download | sqlalchemy-f1e54a69fb9b07a73bd8488110b1ceace168a50a.tar.gz | |
- merge default tip
Diffstat (limited to 'lib/sqlalchemy/util')
| -rw-r--r-- | lib/sqlalchemy/util/langhelpers.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/util/langhelpers.py b/lib/sqlalchemy/util/langhelpers.py index aac22ba30..d85793ee0 100644 --- a/lib/sqlalchemy/util/langhelpers.py +++ b/lib/sqlalchemy/util/langhelpers.py @@ -453,18 +453,20 @@ class importlater(object): @memoized_property def module(self): - m = __import__(self._il_path) - for token in self._il_path.split(".")[1:]: - m = getattr(m, token) if self._il_addtl: + m = __import__(self._il_path, globals(), locals(), + [self._il_addtl]) try: return getattr(m, self._il_addtl) except AttributeError: - raise AttributeError( + raise ImportError( "Module %s has no attribute '%s'" % (self._il_path, self._il_addtl) ) else: + m = __import__(self._il_path) + for token in self._il_path.split(".")[1:]: + m = getattr(m, token) return m def __getattr__(self, key): |
