From 7b799a6fbb7416f9ae1ad55705bf1642a0873e9d Mon Sep 17 00:00:00 2001 From: Bezleputh Date: Wed, 7 May 2014 18:24:48 +0200 Subject: [PATCH] gather collections having the same path --- weboob/tools/application/repl.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/weboob/tools/application/repl.py b/weboob/tools/application/repl.py index a13d8143..e8fa83cf 100644 --- a/weboob/tools/application/repl.py +++ b/weboob/tools/application/repl.py @@ -1029,6 +1029,7 @@ class ReplApplication(Cmd, ConsoleApplication): if sort: objects.sort(cmp=comp_object) + collections = self._merge_collections_with_same_path(collections) collections.sort(cmp=comp_object) for collection in collections: self._format_collection(collection, only) @@ -1042,6 +1043,22 @@ class ReplApplication(Cmd, ConsoleApplication): # Save collections only if we listed the current path. self.collections = collections + def _find_collection(self, collection, collections): + for col in collections: + if col.split_path == collection.split_path: + return col + return None + + def _merge_collections_with_same_path(self, collections): + to_return = [] + for collection in collections: + col = self._find_collection(collection, to_return) + if col: + col.backend += " %s" % collection.backend + else: + to_return.append(collection) + return to_return + def _format_collection(self, collection, only): if only is False or collection.basename in only: