# HG changeset patch # User Brian Neal # Date 1269812471 0 # Node ID 5c889b5874169bad6af11b996ef3c2c7783988ef # Parent 500e5875a30697d318c117c5596e5b70d118c951 Fixing #64. Updating all model save() methods to use *args and **kwargs. Django 1.2 has new keyword arguments. diff -r 500e5875a306 -r 5c889b587416 gpp/bulletins/models.py --- 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') diff -r 500e5875a306 -r 5c889b587416 gpp/comments/models.py --- 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) diff -r 500e5875a306 -r 5c889b587416 gpp/downloads/models.py --- 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""" diff -r 500e5875a306 -r 5c889b587416 gpp/membermap/models.py --- 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) diff -r 500e5875a306 -r 5c889b587416 gpp/messages/models.py --- 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): diff -r 500e5875a306 -r 5c889b587416 gpp/news/models.py --- 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') diff -r 500e5875a306 -r 5c889b587416 gpp/potd/models.py --- 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): diff -r 500e5875a306 -r 5c889b587416 gpp/weblinks/models.py --- 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