changeset 182:5c889b587416

Fixing #64. Updating all model save() methods to use *args and **kwargs. Django 1.2 has new keyword arguments.
author Brian Neal <bgneal@gmail.com>
date Sun, 28 Mar 2010 21:41:11 +0000
parents 500e5875a306
children 149c3567fec1
files gpp/bulletins/models.py gpp/comments/models.py gpp/downloads/models.py gpp/membermap/models.py gpp/messages/models.py gpp/news/models.py gpp/potd/models.py gpp/weblinks/models.py
diffstat 8 files changed, 18 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/gpp/bulletins/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/bulletins/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -38,8 +38,8 @@
     def __unicode__(self):
         return self.title
 
-    def save(self, force_insert=False, force_update=False):
-        super(Bulletin, self).save(force_insert, force_update)
+    def save(self, *args, **kwargs):
+        super(Bulletin, self).save(*args, **kwargs)
         cache.delete('home_bulletins')
 
      
--- a/gpp/comments/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/comments/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -51,9 +51,9 @@
     def __unicode__(self):
         return u'%s: %s...' % (self.user.username, self.comment[:50])
 
-    def save(self, force_insert=False, force_update=False):
+    def save(self, *args, **kwargs):
         self.html = site_markup(self.comment)
-        super(Comment, self).save(force_insert, force_update)
+        super(Comment, self).save(*args, **kwargs)
 
     def get_absolute_url(self):
         return self.get_content_object_url() + ('#c%s' % self.id)
--- a/gpp/downloads/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/downloads/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -72,9 +72,9 @@
     def get_absolute_url(self):
         return ('downloads-details', [str(self.id)])
 
-    def save(self, force_insert=False, force_update=False):
+    def save(self, *args, **kwargs):
         self.html = site_markup(self.description)
-        super(Download, self).save(force_insert, force_update)
+        super(Download, self).save(*args, **kwargs)
 
     def vote(self, vote_value):
         """receives a vote_value and updates internal score accordingly"""
--- a/gpp/membermap/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/membermap/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -27,7 +27,7 @@
         ordering = ('-date_updated', )
         verbose_name_plural = 'map entries'
 
-    def save(self, force_insert=False, force_update=False):
+    def save(self, *args, **kwargs):
         msg = render_to_string('membermap/markdown.html', {
             'user': self.user,
             'msg': site_markup(self.message)}).strip()
@@ -37,5 +37,5 @@
             'lon': '%10.6f' % self.lon,
             'message': msg,
             })
-        super(MapEntry, self).save(force_insert, force_update)
+        super(MapEntry, self).save(*args, **kwargs)
 
--- a/gpp/messages/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/messages/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -61,11 +61,11 @@
             return True
         return False
 
-    def save(self, force_insert = False, force_update = False):
+    def save(self, *args, **kwargs):
         if not self.id:
             self.send_date = datetime.datetime.now()
         self.html = site_markup(self.message)
-        super(Message, self).save(force_insert, force_update)
+        super(Message, self).save(*args, **kwargs)
 
     @models.permalink
     def get_absolute_url(self):
--- a/gpp/news/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/news/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -37,7 +37,7 @@
     approved = models.BooleanField(default=False)
     tags = TagField()
 
-    def save(self, force_insert = False, force_update = False):
+    def save(self, *args, **kwargs):
         if self.approved:
             Story.objects.create(title=self.title,
                     submitter=self.submitter,
@@ -50,7 +50,7 @@
             self.delete()
             cache.delete('home_news')
         else:
-            super(PendingStory, self).save(force_insert, force_update)
+            super(PendingStory, self).save(*args, **kwargs)
 
     def __unicode__(self):
         return self.title
@@ -87,7 +87,7 @@
         delta = now - self.date_published
         return delta.days < 30
 
-    def save(self, force_insert=False, force_update=False):
-        super(Story, self).save(force_insert, force_update)
+    def save(self, *args, **kwargs):
+        super(Story, self).save(*args, **kwargs)
         cache.delete('home_news')
 
--- a/gpp/potd/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/potd/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -44,7 +44,7 @@
     def get_absolute_url(self):
         return ('potd-archive', [str(self.id)])
 
-    def save(self, force_insert=False, force_update=False):
+    def save(self, *args, **kwargs):
 
         if self.thumb:
             self.thumb.delete(save=False)
@@ -60,7 +60,7 @@
         thumb_name = os.path.basename(self.photo.path)
         self.thumb.save(thumb_name, ContentFile(s.getvalue()), save=False)
         
-        super(Photo, self).save(force_insert, force_update)
+        super(Photo, self).save(*args, **kwargs)
         Sequence.objects.insert_photo(self.pk)
 
     def delete(self):
--- a/gpp/weblinks/models.py	Sun Mar 28 01:07:47 2010 +0000
+++ b/gpp/weblinks/models.py	Sun Mar 28 21:41:11 2010 +0000
@@ -71,12 +71,12 @@
 
     objects = FlaggedLinkManager()
 
-    def save(self, force_insert = False, force_update = False):
+    def save(self, *args, **kwargs):
         if self.approved:
             self.link.delete()
             self.delete()
         else:
-            super(FlaggedLink, self).save(force_insert, force_update)
+            super(FlaggedLink, self).save(*args, **kwargs)
 
     def url(self):
         return self.link.url