Show More
@@ -401,13 +401,16 b' class DirectView(View):' | |||
|
401 | 401 | return self.sync_imports(True) |
|
402 | 402 | |
|
403 | 403 | @contextmanager |
|
404 | def sync_imports(self, local=True): | |
|
404 | def sync_imports(self, local=True, quiet=False): | |
|
405 | 405 | """Context Manager for performing simultaneous local and remote imports. |
|
406 | 406 | |
|
407 | 407 | 'import x as y' will *not* work. The 'as y' part will simply be ignored. |
|
408 | 408 | |
|
409 | 409 | If `local=True`, then the package will also be imported locally. |
|
410 | 410 | |
|
411 | If `quiet=True`, then no message concerning the success of import will be | |
|
412 | reported. | |
|
413 | ||
|
411 | 414 | Note that remote-only (`local=False`) imports have not been implemented. |
|
412 | 415 | |
|
413 | 416 | >>> with view.sync_imports(): |
@@ -456,10 +459,11 b' class DirectView(View):' | |||
|
456 | 459 | key = name+':'+','.join(fromlist or []) |
|
457 | 460 | if level == -1 and key not in modules: |
|
458 | 461 | modules.add(key) |
|
459 |
if |
|
|
460 | print "importing %s from %s on engine(s)"%(','.join(fromlist), name) | |
|
461 | else: | |
|
462 | print "importing %s on engine(s)"%name | |
|
462 | if not quiet: | |
|
463 | if fromlist: | |
|
464 | print "importing %s from %s on engine(s)"%(','.join(fromlist), name) | |
|
465 | else: | |
|
466 | print "importing %s on engine(s)"%name | |
|
463 | 467 | results.append(self.apply_async(remote_import, name, fromlist, level)) |
|
464 | 468 | # restore override |
|
465 | 469 | __builtin__.__import__ = save_import |
General Comments 0
You need to be logged in to leave comments.
Login now