1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
From 8f2c08718bff601b1f94dadd0c47a63b6db22c7d Mon Sep 17 00:00:00 2001
From: Ajay Garg <ajaygargnsit@gmail.com>
Date: Fri, 9 Sep 2011 17:21:50 +0000
Subject: [PATCH sugar 61/74] 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>
---
.../cpsection/updater/backends/microformat.py | 2 +-
extensions/cpsection/updater/model.py | 6 ++++--
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 @@ def handle_starttag(self, tag, attrs):
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 @@ def __bundle_info_fetched_cb(self, new_bundles, error_message):
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 @@ def __init__(self, model):
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,
--
1.7.6
|