~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 09:50:04 UTC
  • mfrom: (6424 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6426.
  • Revision ID: martin.packman@canonical.com-20120105095004-mia9xb7y0efmto0v
Merge bzr.dev to resolve conflicts in bzrlib.builtins

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.
195
197
        module_path = object.__getattribute__(self, '_module_path')
196
198
        module_python_path = '.'.join(module_path)
197
199
        if member is not None:
198
 
            module = __import__(module_python_path, scope, scope, [member])
 
200
            module = __import__(module_python_path, scope, scope, [member], level=0)
199
201
            return getattr(module, member)
200
202
        else:
201
 
            module = __import__(module_python_path, scope, scope, [])
 
203
            module = __import__(module_python_path, scope, scope, [], level=0)
202
204
            for path in module_path[1:]:
203
205
                module = getattr(module, path)
204
206