[extensions-web] update: Don't take a metadata object, just a uuid => version
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] update: Don't take a metadata object, just a uuid => version
- Date: Sun, 18 Dec 2011 23:33:34 +0000 (UTC)
commit 3fa9240711c077e4705ead598b1a6e8e69d8226e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Dec 18 04:45:26 2011 -0500
update: Don't take a metadata object, just a uuid => version
The update code was written with the assumption that we would just
be sending over the raw extensionMeta object, but it's not that much
harder to send just the version over, and it saves a bunch of network
traffic that may be expensive for some users.
sweettooth/extensions/tests.py | 6 +-----
sweettooth/extensions/views.py | 10 +---------
2 files changed, 2 insertions(+), 14 deletions(-)
---
diff --git a/sweettooth/extensions/tests.py b/sweettooth/extensions/tests.py
index afac94d..3786ac4 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -308,11 +308,7 @@ class UpdateVersionTest(TestCase):
self.downgrade_uuid: dict(operation='downgrade',
version=downgrade_pk) }
- def grab_response(self, uuids):
- installed = {}
- for uuid, version in uuids.iteritems():
- installed[uuid] = dict(version=version)
-
+ def grab_response(self, installed):
post_data = dict(installed=json.dumps(installed))
response = self.client.post(reverse('extensions-shell-update'),
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index 6df9782..a567524 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -45,20 +45,12 @@ def shell_update(request):
installed = json.loads(request.POST['installed'])
operations = {}
- for uuid, meta in installed.iteritems():
+ for uuid, version in installed.iteritems():
try:
extension = models.Extension.objects.get(uuid=uuid)
except models.Extension.DoesNotExist:
continue
- if 'version' not in meta:
- # Some extensions may be on the site, but if the user
- # didn't download it from SweetTooth, there won't
- # be a version value in the metadata.
- continue
-
- version = meta['version']
-
try:
version_obj = extension.versions.get(version=version)
except models.ExtensionVersion.DoesNotExist:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]