def load_module self fullname name fullname len needle parts name spli

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
def load_module(self, fullname):
name = fullname[len(needle)+1:]
parts = name.split('.')
mod = None
for i, v in enumerate(parts):
p = '.'.join(parts[:i])
if p in self.apps:
name = self.apps[p]
if i + 1 < len(parts):
name.append('.%s' % ('.'.join(parts[i+1:])))
mod = __import__(name)
sys.modules[fullname] = mod
break
if mod is None:
raise ImportError('Failed to import virtual Svarga application %r' % fullpath)
return mod