Sort results in comparoob

Close #934
This commit is contained in:
Florent 2012-11-12 14:12:50 +01:00 committed by Romain Bignon
commit 456d2d1fe0

View file

@ -119,10 +119,16 @@ class Comparoob(ReplApplication):
self.change_path([u'prices'])
self.start_format()
products = []
for backend, price in self.do('iter_prices', product):
products.append(price)
for price in sorted(products, key=self._get_price):
self.cached_format(price)
self.flush()
def _get_price(self, price):
return price.cost
def complete_info(self, text, line, *ignored):
args = line.split(' ')
if len(args) == 2: