diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-25 10:36:31 -0500 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2010-11-25 10:36:31 -0500 |
| commit | 5247c244ca6595f2685f1c0c271618eda7cb5e62 (patch) | |
| tree | 608b915bc9c17b5ae16036fc0fb691379bc65cc2 /lib/sqlalchemy | |
| parent | b2a0b6091de5c7e4443acd83599f7bf39202ee74 (diff) | |
| download | sqlalchemy-5247c244ca6595f2685f1c0c271618eda7cb5e62.tar.gz | |
- adjust importlater to import the full path, break out of "import" problems with ImportError,
[ticket:1983]
Diffstat (limited to 'lib/sqlalchemy')
| -rw-r--r-- | lib/sqlalchemy/util.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py index 8665cd0d4..dafba8250 100644 --- a/lib/sqlalchemy/util.py +++ b/lib/sqlalchemy/util.py @@ -1578,14 +1578,17 @@ class importlater(object): @memoized_property def _il_module(self): - m = __import__(self._il_path) + if self._il_addtl: + m = __import__(self._il_path + "." + self._il_addtl) + else: + m = __import__(self._il_path) for token in self._il_path.split(".")[1:]: m = getattr(m, token) if 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) ) |
