diff options
author | Ajay Garg <ajaygargnsit@gmail.com> | 2011-09-09 17:21:50 (GMT) |
---|---|---|
committer | Anish Mangal <anish@activitycentral.com> | 2012-04-27 10:02:35 (GMT) |
commit | 780b702e5976a7e2b5ea200a3975eff81ebb5062 (patch) | |
tree | 23d685ec9c4e7cad04ae1a5ea43435d5f83b1f71 | |
parent | b220ad713ed848c0bb0013f787addc2db80f0e0f (diff) |
Don't choke on non-integer activities
Since Sugar 0.92 activity versions can be non-integer strings.
Signed-off-by: Ajay Garg <ajay@sugarlabs.org>
[split out from other patch, added description, correctly handle comparison;
include fix from Jerry Vonau]
Signed-off-by: Sascha Silbe <silbe@activitycentral.com>
-rw-r--r-- | extensions/cpsection/updater/backends/microformat.py | 2 | ||||
-rwxr-xr-x | extensions/cpsection/updater/model.py | 6 | ||||
-rw-r--r-- | extensions/cpsection/updater/view.py | 2 |
3 files changed, 6 insertions, 4 deletions
diff --git a/extensions/cpsection/updater/backends/microformat.py b/extensions/cpsection/updater/backends/microformat.py index 97499aa..ca4f1d5 100644 --- a/extensions/cpsection/updater/backends/microformat.py +++ b/extensions/cpsection/updater/backends/microformat.py @@ -133,7 +133,7 @@ class MicroformatParser(HTMLParser): def handle_data(self, data): if self._inside_activity_version: - self._activity_version = int(data) + self._activity_version = str(data) self._inside_activity_version = False elif self._inside_activity_id: diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py index d7fd528..1a3941c 100755 --- a/extensions/cpsection/updater/model.py +++ b/extensions/cpsection/updater/model.py @@ -106,8 +106,10 @@ class UpdateModel(gobject.GObject): else: for bundle_id, info in new_bundles.items(): if bundle_id in self._current_bundles: - if new_bundles[bundle_id]['version'] >\ - self._current_bundles[bundle_id]['version']: + old_version = self._current_bundles[bundle_id]['version'] + new_version = new_bundles[bundle_id]['version'] + if NormalizedVersion(old_version) < \ + NormalizedVersion(new_version): self.updates.append(BundleUpdate( self._current_bundles[bundle_id]['bundle'], new_bundles[bundle_id]['version'], diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py index 30875e4..559ab8d 100644 --- a/extensions/cpsection/updater/view.py +++ b/extensions/cpsection/updater/view.py @@ -362,7 +362,7 @@ class UpdateListModel(gtk.ListStore): row[self.ICON_FILE_NAME] = bundle_update.bundle.get_icon() if bundle_update.package_type == 'update': - details = _('From version %(current)d to %(new)s (Size: %(size)s)') + details = _('From version %(current)s to %(new)s (Size: %(size)s)') details = details % \ {'current': bundle_update.bundle.get_activity_version(), 'new': bundle_update.version, |