From 86ee414f3cf517a8ceaec1c9d70dccb818e15b48 Mon Sep 17 00:00:00 2001 From: benjaoming Date: Fri, 1 Feb 2013 14:09:00 +0100 Subject: [PATCH] receive post_save signal only using kwargs --- wiki/models/pluginbase.py | 3 ++- wiki/models/urlpath.py | 3 ++- wiki/plugins/notifications/models.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wiki/models/pluginbase.py b/wiki/models/pluginbase.py index 4928f39f..78174fd4 100644 --- a/wiki/models/pluginbase.py +++ b/wiki/models/pluginbase.py @@ -239,9 +239,10 @@ class RevisionPluginRevision(BaseRevisionMixin, models.Model): # It's my art, when I disguise my body in the shape of a plane. # (Shellac, 1993) -def update_simple_plugins(instance, *args, **kwargs): +def update_simple_plugins(**kwargs): """Every time a new article revision is created, we update all active plugins to match this article revision""" + instance = kwargs['instance'] if kwargs.get('created', False): p_revisions = SimplePlugin.objects.filter(article=instance.article, deleted=False) # TODO: This was breaking things. SimplePlugin doesn't have a revision? diff --git a/wiki/models/urlpath.py b/wiki/models/urlpath.py index cc3e42a9..72e565fd 100644 --- a/wiki/models/urlpath.py +++ b/wiki/models/urlpath.py @@ -235,8 +235,9 @@ class URLPath(MPTTModel): # Just get this once urlpath_content_type = None -def on_article_relation_save(instance, *args, **kwargs): +def on_article_relation_save(**kwargs): global urlpath_content_type + instance = kwargs['instance'] if not urlpath_content_type: urlpath_content_type = ContentType.objects.get_for_model(URLPath) if instance.content_type == urlpath_content_type: diff --git a/wiki/plugins/notifications/models.py b/wiki/plugins/notifications/models.py index c3808ba5..d79e91d9 100644 --- a/wiki/plugins/notifications/models.py +++ b/wiki/plugins/notifications/models.py @@ -34,7 +34,8 @@ def default_url(article, urlpath=None): url = reverse('wiki:get', kwargs={'article_id': article.id}) return url -def post_article_revision_save(instance, **kwargs): +def post_article_revision_save(**kwargs): + instance = kwargs['instance'] if kwargs.get('created', False): url = default_url(instance.article) if instance.deleted: -- 2.45.2