##// END OF EJS Templates
demandimport: fix level passed to loader of sub-modules...
Yuya Nishihara -
r26873:78d05778 stable
parent child Browse files
Show More
@@ -164,7 +164,7 b' def _demandimport(name, globals=None, lo'
164 # The name of the module the import statement is located in.
164 # The name of the module the import statement is located in.
165 globalname = globals.get('__name__')
165 globalname = globals.get('__name__')
166
166
167 def processfromitem(mod, attr, **kwargs):
167 def processfromitem(mod, attr):
168 """Process an imported symbol in the import statement.
168 """Process an imported symbol in the import statement.
169
169
170 If the symbol doesn't exist in the parent module, it must be a
170 If the symbol doesn't exist in the parent module, it must be a
@@ -172,7 +172,7 b' def _demandimport(name, globals=None, lo'
172 """
172 """
173 symbol = getattr(mod, attr, nothing)
173 symbol = getattr(mod, attr, nothing)
174 if symbol is nothing:
174 if symbol is nothing:
175 symbol = _demandmod(attr, mod.__dict__, locals, **kwargs)
175 symbol = _demandmod(attr, mod.__dict__, locals, level=1)
176 setattr(mod, attr, symbol)
176 setattr(mod, attr, symbol)
177
177
178 # Record the importing module references this symbol so we can
178 # Record the importing module references this symbol so we can
@@ -194,7 +194,7 b' def _demandimport(name, globals=None, lo'
194 mod = _hgextimport(_origimport, name, globals, locals, level=level)
194 mod = _hgextimport(_origimport, name, globals, locals, level=level)
195
195
196 for x in fromlist:
196 for x in fromlist:
197 processfromitem(mod, x, level=level)
197 processfromitem(mod, x)
198
198
199 return mod
199 return mod
200
200
General Comments 0
You need to be logged in to leave comments. Login now