# HG changeset patch # User Brian Neal # Date 1313544567 0 # Node ID d9b6c4ec1977a7c0d750fc28659baef9dc7693ed # Parent 3b30286adba5735c75f410d7d1815e291362d1e5 For #227; rework last commit slightly (r508). Adapt the desired forums signal signature to the queued_search API instead of the other way around. diff -r 3b30286adba5 -r d9b6c4ec1977 gpp/forums/search_indexes.py --- a/gpp/forums/search_indexes.py Wed Aug 17 01:02:08 2011 +0000 +++ b/gpp/forums/search_indexes.py Wed Aug 17 01:29:27 2011 +0000 @@ -24,6 +24,9 @@ def _teardown_save(self, model): topic_content_update.disconnect(self.enqueue_save) + def enqueue_save(self, sender, **kwargs): + return self.enqueue('update', sender) + def can_index(self, instance): return instance.forum.id in Forum.objects.public_forum_ids() @@ -46,6 +49,9 @@ def _teardown_save(self, model): post_content_update.disconnect(self.enqueue_save) + def enqueue_save(self, sender, **kwargs): + return self.enqueue('update', sender) + def can_index(self, instance): return instance.topic.forum.id in Forum.objects.public_forum_ids() diff -r 3b30286adba5 -r d9b6c4ec1977 gpp/forums/signals.py --- a/gpp/forums/signals.py Wed Aug 17 01:02:08 2011 +0000 +++ b/gpp/forums/signals.py Wed Aug 17 01:29:27 2011 +0000 @@ -74,18 +74,16 @@ # This signal is sent when a topic has had its textual content (title) changed. # The provided arguments are: # sender - the topic model instance -# instance - the topic model instance # created - True if the topic is new, False if updated -topic_content_update = django.dispatch.Signal(providing_args=['action']) +topic_content_update = django.dispatch.Signal(providing_args=['created']) # This signal is sent when a post has had its textual content (body) changed. # The provided arguments are: # sender - the post model instance -# instance - the topic model instance # created - True if the post is new, False if updated -post_content_update = django.dispatch.Signal(providing_args=['action']) +post_content_update = django.dispatch.Signal(providing_args=['created']) def notify_new_topic(topic): @@ -93,7 +91,7 @@ Sends the topic_content_update signal for a new topic instance. """ - topic_content_update.send_robust(topic, instance=topic, created=True) + topic_content_update.send_robust(topic, created=True) def notify_updated_topic(topic): @@ -101,7 +99,7 @@ Sends the topic_content_update signal for an updated topic instance. """ - topic_content_update.send_robust(topic, instance=topic, created=False) + topic_content_update.send_robust(topic, created=False) def notify_new_post(post): @@ -109,7 +107,7 @@ Sends the post_content_update signal for a new post instance. """ - post_content_update.send_robust(post, instance=post, created=True) + post_content_update.send_robust(post, created=True) def notify_updated_post(post): @@ -117,4 +115,4 @@ Sends the post_content_update signal for an updated post instance. """ - post_content_update.send_robust(post, instance=post, created=False) + post_content_update.send_robust(post, created=False)