Permalink
Browse files

Fix sorting and always use installed version for it

  • Loading branch information...
1 parent 8213a2c commit d8e435ba9a9733d1e2edae0310b7650c5a997baa J. Victor Martins committed Jun 10, 2011
Showing with 5 additions and 6 deletions.
  1. +4 −5 mdvpkg/tasks.py
  2. +1 −1 mdvpkg/urpmi/db.py
View
@@ -386,8 +386,7 @@ def Get(self, index, attributes, sender):
log.info('attempt to call Get() without STATE_READY')
raise mdvpkg.exceptions.TaskBadState
package, installs, upgrades = self._package_list[index]
- self._emit_package(self,
- index,
+ self._emit_package(index,
package,
attributes,
installs,
@@ -405,9 +404,9 @@ def Sort(self, key, reverse, sender):
log.info('attempt to call Sort() without STATE_READY')
raise mdvpkg.exceptions.TaskBadState
if key in {'status', 'name'}:
- key_func = lambda pkg: getattr(pkg, key)
+ key_func = lambda data: getattr(data[0], key)
else:
- key_func = lambda pkg: getattr(pkg.latest, key)
+ key_func = lambda data: getattr(data[0].latest, key)
self._package_list.sort(key=key_func, reverse=reverse)
@dbus.service.method(mdvpkg.DBUS_TASK_INTERFACE,
@@ -441,7 +440,7 @@ def run(self, urpmi):
upgrades = self._select_versions(package.upgrades.values())
if installs or upgrades:
if self._create_list:
- self._package_list.append(package, intalls, upgrades)
+ self._package_list.append((package, installs, upgrades))
else:
self._emit_package(count,
package,
View
@@ -363,7 +363,7 @@ def latest_upgrade(self):
@property
def latest(self):
"""The latest package in the entry based."""
- if self.status in {'new', 'upgrade'}:
+ if self.status in {'new'}:
return self.latest_upgrade
else:
return self.latest_installed

0 comments on commit d8e435b

Please sign in to comment.