diff options
author | Ajay Garg <ajaygargnsit@gmail.com> | 2011-09-09 17:21:50 (GMT) |
---|---|---|
committer | Anish Mangal <anish@activitycentral.com> | 2012-02-01 12:33:31 (GMT) |
commit | 5efc78a22bade9114bcc53bc6eac4396d1511de0 (patch) | |
tree | 3c81fce722406a17775e91882f40acf8eb041503 | |
parent | 6261d3339a9913692fe565dc7886b43a3dc1c5ed (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, |