~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lazy_import.py

  • Committer: Martin Packman
  • Date: 2012-01-05 10:44:12 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6427.
  • Revision ID: martin.packman@canonical.com-20120105104412-z03fi9m43h946fvs
Merge bzr.dev to resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
to inherit from them).
42
42
"""
43
43
 
 
44
from __future__ import absolute_import
 
45
 
44
46
 
45
47
class ScopeReplacer(object):
46
48
    """A lazy object that will replace itself in the appropriate scope.
208
210
        module_path = object.__getattribute__(self, '_module_path')
209
211
        module_python_path = '.'.join(module_path)
210
212
        if member is not None:
211
 
            module = __import__(module_python_path, scope, scope, [member])
 
213
            module = __import__(module_python_path, scope, scope, [member], level=0)
212
214
            return getattr(module, member)
213
215
        else:
214
 
            module = __import__(module_python_path, scope, scope, [])
 
216
            module = __import__(module_python_path, scope, scope, [], level=0)
215
217
            for path in module_path[1:]:
216
218
                module = getattr(module, path)
217
219