[extensions-web] Use 'version", not "version_tag" when we mean a consecutive version



commit 7252e9fd70291abe0ad84abe9131bc87064d3160
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Nov 27 18:16:16 2011 -0500

    Use 'version", not "version_tag" when we mean a consecutive version
    
    Without thinking, I added "version_tag" to the metadata, without realizing
    that I was adding a consecutive version. Before this gets any more confusing,
    and before SweetTooth launches, let's fix that right now.
    
    This also fixes installation on GNOME Shell. GNOME Shell, when grabbing
    extension details to put in its Install Dialog, sent along the "version_tag",
    meaning the PK, because, hey, why not. This unfortunately conflicted with
    the recent Undo changes which made "version_tag" mean "the value of version_tag
    in the metadata".

 sweettooth/extensions/models.py    |    2 +-
 sweettooth/extensions/tests.py     |    8 ++++----
 sweettooth/extensions/views.py     |   16 ++++++++--------
 sweettooth/static/js/extensions.js |    2 +-
 4 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index 9ad805a..4262825 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -233,7 +233,7 @@ class ExtensionVersion(models.Model):
             description = self.extension.description,
             url         = self.extension.url,
             uuid        = self.extension.uuid,
-            version_tag = self.version,
+            version     = self.version,
         )
 
         fields['shell-version'] = [sv.version_string for sv in self.shell_versions.all()]
diff --git a/sweettooth/extensions/tests.py b/sweettooth/extensions/tests.py
index ea13af3..afac94d 100644
--- a/sweettooth/extensions/tests.py
+++ b/sweettooth/extensions/tests.py
@@ -303,15 +303,15 @@ class UpdateVersionTest(TestCase):
         downgrade_pk = models.Extension.objects.get(uuid=self.downgrade_uuid).latest_version.pk
 
         self.full_expected = { self.upgrade_uuid: dict(operation='upgrade',
-                                                       version_tag=upgrade_pk),
+                                                       version=upgrade_pk),
                                self.reject_uuid: dict(operation='blacklist'),
                                self.downgrade_uuid: dict(operation='downgrade',
-                                                         version_tag=downgrade_pk) }
+                                                         version=downgrade_pk) }
 
     def grab_response(self, uuids):
         installed = {}
-        for uuid, version_tag in uuids.iteritems():
-            installed[uuid] = dict(version_tag=version_tag)
+        for uuid, version in uuids.iteritems():
+            installed[uuid] = dict(version=version)
 
         post_data = dict(installed=json.dumps(installed))
 
diff --git a/sweettooth/extensions/views.py b/sweettooth/extensions/views.py
index a3e70ad..33c5a24 100644
--- a/sweettooth/extensions/views.py
+++ b/sweettooth/extensions/views.py
@@ -42,13 +42,13 @@ def shell_update(request):
         except models.Extension.DoesNotExist:
             continue
 
-        if 'version_tag' not in meta:
+        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_tag value in the metadata.
+            # be a version value in the metadata.
             continue
 
-        version = meta['version_tag']
+        version = meta['version']
 
         try:
             version_obj = extension.versions.get(version=version)
@@ -63,11 +63,11 @@ def shell_update(request):
 
         elif version < latest_version.version:
             operations[uuid] = dict(operation="upgrade",
-                                    version_tag=extension.latest_version.pk)
+                                    version=extension.latest_version.pk)
 
         elif version_obj.status in models.REJECTED_STATUSES:
             operations[uuid] = dict(operation="downgrade",
-                                    version_tag=extension.latest_version.pk)
+                                    version=extension.latest_version.pk)
 
     return operations
 
@@ -213,7 +213,7 @@ def ajax_details(extension):
 @ajax_view
 def ajax_details_view(request):
     uuid = request.GET.get('uuid', None)
-    version_tag = request.GET.get('version_tag', None)
+    version = request.GET.get('version', None)
 
     if uuid is None:
         raise Http404()
@@ -221,8 +221,8 @@ def ajax_details_view(request):
     extension = get_object_or_404(models.Extension, uuid=uuid)
     details = ajax_details(extension)
 
-    if version_tag is not None:
-        version = extension.versions.get(version=version_tag)
+    if version is not None:
+        version = extension.versions.get(version=version)
         details['pk'] = version.pk
 
     return details
diff --git a/sweettooth/static/js/extensions.js b/sweettooth/static/js/extensions.js
index ae14d4e..29552cc 100644
--- a/sweettooth/static/js/extensions.js
+++ b/sweettooth/static/js/extensions.js
@@ -202,7 +202,7 @@ function($, messages, dbusProxy) {
                             url: "/ajax/detail/",
                             dataType: "json",
                             data: { uuid: extension.version,
-                                    version_tag: extension.version_tag },
+                                    version: extension.version },
                             type: "GET",
                         }).done(function(result) {
                             $elem.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]