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