~netlandish/django-wiki

86ee414f3cf517a8ceaec1c9d70dccb818e15b48 — benjaoming 11 years ago 91076f2
receive post_save signal only using kwargs
3 files changed, 6 insertions(+), 3 deletions(-)

M wiki/models/pluginbase.py
M wiki/models/urlpath.py
M wiki/plugins/notifications/models.py
M wiki/models/pluginbase.py => wiki/models/pluginbase.py +2 -1
@@ 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?

M wiki/models/urlpath.py => wiki/models/urlpath.py +2 -1
@@ 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:

M wiki/plugins/notifications/models.py => wiki/plugins/notifications/models.py +2 -1
@@ 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: