[extensions-web/filter-sort-ui: 9/20] Allow saving models without replacing metadata.json



commit 51ea1893991653db69acc73bc84d9095874757f5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Mon Jan 2 16:23:29 2012 -0500

    Allow saving models without replacing metadata.json

 sweettooth/extensions/models.py |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/extensions/models.py b/sweettooth/extensions/models.py
index cc34a18..0b13fdf 100644
--- a/sweettooth/extensions/models.py
+++ b/sweettooth/extensions/models.py
@@ -122,11 +122,12 @@ class Extension(models.Model):
         if not validate_uuid(self.uuid):
             raise ValidationError("Invalid UUID")
 
-    def save(self, *args, **kwargs):
+    def save(self, replace_metadata_json=True, *args, **kwargs):
         super(Extension, self).save(*args, **kwargs)
-        for version in self.versions.all():
-            if version.source:
-                version.replace_metadata_json()
+        if replace_metadata_json:
+            for version in self.versions.all():
+                if version.source:
+                    version.replace_metadata_json()
  
     @property
     def visible_shell_version_map(self):



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