Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/extensions
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2010-11-09 11:04:49 (GMT)
committer Simon Schampijer <simon@schampijer.de>2010-11-09 11:04:49 (GMT)
commit468fe070e0a60e9690e89a0649919509c310974e (patch)
tree292677aa17f007b39cf3a5fd58964239106d508c /extensions
parent49232e552248e48063970ca67455462d11220468 (diff)
Adapt activity updater to new numbering scheme #2425
From ASLO we get a string, we have to verify if this matches our scheme. For the Update check we have to use the new class NormalizedVersion and there was a small formatting change (int -> string).
Diffstat (limited to 'extensions')
-rw-r--r--extensions/cpsection/updater/backends/aslo.py9
-rwxr-xr-xextensions/cpsection/updater/model.py4
-rw-r--r--extensions/cpsection/updater/view.py2
3 files changed, 10 insertions, 5 deletions
diff --git a/extensions/cpsection/updater/backends/aslo.py b/extensions/cpsection/updater/backends/aslo.py
index 5f257f9..3d63406 100644
--- a/extensions/cpsection/updater/backends/aslo.py
+++ b/extensions/cpsection/updater/backends/aslo.py
@@ -54,6 +54,9 @@ import traceback
import gio
+from sugar.bundle.bundleversion import NormalizedVersion
+from sugar.bundle.bundleversion import InvalidVersionError
+
from jarabe import config
_FIND_DESCRIPTION = \
@@ -127,10 +130,10 @@ class _UpdateFetcher(object):
size = None
else:
try:
- version = int(document.find(_FIND_VERSION).text)
- except ValueError:
+ version = NormalizedVersion(document.find(_FIND_VERSION).text)
+ except InvalidVersionError:
logging.error(traceback.format_exc())
- version = 0
+ version = '0'
link = document.find(_FIND_LINK).text
diff --git a/extensions/cpsection/updater/model.py b/extensions/cpsection/updater/model.py
index 9845371..d58e3bc 100755
--- a/extensions/cpsection/updater/model.py
+++ b/extensions/cpsection/updater/model.py
@@ -33,6 +33,7 @@ import gio
from sugar import env
from sugar.datastore import datastore
from sugar.bundle.activitybundle import ActivityBundle
+from sugar.bundle.bundleversion import NormalizedVersion
from jarabe.model import bundleregistry
@@ -83,7 +84,8 @@ class UpdateModel(gobject.GObject):
logging.error('Error getting update information from server:\n'
'%s' % error_message)
- if version is not None and version > bundle.get_activity_version():
+ if version is not None and \
+ version > NormalizedVersion(bundle.get_activity_version()):
self.updates.append(BundleUpdate(bundle, version, link, size))
if self._cancelling:
diff --git a/extensions/cpsection/updater/view.py b/extensions/cpsection/updater/view.py
index 2164c0b..ce853fb 100644
--- a/extensions/cpsection/updater/view.py
+++ b/extensions/cpsection/updater/view.py
@@ -359,7 +359,7 @@ class UpdateListModel(gtk.ListStore):
row[self.SELECTED] = True
row[self.ICON_FILE_NAME] = bundle_update.bundle.get_icon()
- 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,