[extensions-web] extensions: Take a "metadata" object
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] extensions: Take a "metadata" object
- Date: Fri, 6 Jul 2012 23:00:49 +0000 (UTC)
commit 8441f5c068e39eea23a8935c5968884e6bd0c318
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Jun 26 17:14:47 2012 -0400
extensions: Take a "metadata" object
This way, the Shell can just serialize ExtensionUtils.extensions without
having to shuttle over "version".
sweettooth/extensions/tests.py | 4 ++++
sweettooth/extensions/views.py | 9 ++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/extensions/tests.py b/sweettooth/extensions/tests.py
index 16f3001..215f6b3 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -474,7 +474,11 @@ class UpdateVersionTest(TestCase):
self.downgrade_uuid: dict(operation='downgrade',
version_tag=downgrade_pk) }
+ def build_response(self, installed):
+ return dict((k, dict(version=v)) for k, v in installed.iteritems())
+
def grab_response(self, installed):
+ installed = self.build_response(installed)
response = self.client.get(reverse('extensions-shell-update'),
dict(installed=json.dumps(installed), shell_version='3.2.0'))
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 85127ff..7d64691 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -88,7 +88,14 @@ def shell_update(request):
shell_version = request.GET['shell_version']
operations = {}
- for uuid, version in installed.iteritems():
+ for uuid, meta in installed.iteritems():
+ try:
+ version = meta['version']
+ except KeyError:
+ # XXX - if the user has a locally installed version of
+ # an extension on SweetTooth, what should we do?
+ continue
+
try:
extension = models.Extension.objects.get(uuid=uuid)
except models.Extension.DoesNotExist:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]