[repl] Optimization: do not fetch the collections when not needed
This commit is contained in:
parent
3dd7caf59d
commit
c6a9abcc7e
1 changed files with 19 additions and 18 deletions
|
|
@ -1053,25 +1053,26 @@ class ReplApplication(Cmd, ConsoleApplication):
|
||||||
else:
|
else:
|
||||||
self.working_path.cd1(line)
|
self.working_path.cd1(line)
|
||||||
|
|
||||||
collections = []
|
collections = []
|
||||||
try:
|
try:
|
||||||
for backend, res in self.do('get_collection', objs=self.COLLECTION_OBJECTS,
|
for backend, res in self.do('get_collection', objs=self.COLLECTION_OBJECTS,
|
||||||
split_path=self.working_path.get(),
|
split_path=self.working_path.get(),
|
||||||
caps=ICapCollection):
|
caps=ICapCollection):
|
||||||
if res:
|
if res:
|
||||||
collections.append(res)
|
collections.append(res)
|
||||||
except CallErrors as errors:
|
except CallErrors as errors:
|
||||||
self.bcall_errors_handler(errors, CollectionNotFound)
|
self.bcall_errors_handler(errors, CollectionNotFound)
|
||||||
|
|
||||||
if len(collections):
|
if len(collections):
|
||||||
# update the path from the collection if possible
|
# update the path from the collection if possible
|
||||||
if len(collections) == 1:
|
if len(collections) == 1:
|
||||||
self.working_path.split_path = collections[0].split_path
|
self.working_path.split_path = collections[0].split_path
|
||||||
self._change_prompt()
|
else:
|
||||||
else:
|
print >>sys.stderr, u"Path: %s not found" % unicode(self.working_path)
|
||||||
print >>sys.stderr, u"Path: %s not found" % unicode(self.working_path)
|
self.working_path.restore()
|
||||||
self.working_path.restore()
|
return 1
|
||||||
return 1
|
|
||||||
|
self._change_prompt()
|
||||||
|
|
||||||
def _fetch_objects(self, objs):
|
def _fetch_objects(self, objs):
|
||||||
objects = []
|
objects = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue