comparison gpp/forums/search_indexes.py @ 470:d9b6c4ec1977

For #227; rework last commit slightly (r508). Adapt the desired forums signal signature to the queued_search API instead of the other way around.
author Brian Neal <bgneal@gmail.com>
date Wed, 17 Aug 2011 01:29:27 +0000
parents 3b30286adba5
children 387d46abcb95
comparison
equal deleted inserted replaced
469:3b30286adba5 470:d9b6c4ec1977
22 topic_content_update.connect(self.enqueue_save) 22 topic_content_update.connect(self.enqueue_save)
23 23
24 def _teardown_save(self, model): 24 def _teardown_save(self, model):
25 topic_content_update.disconnect(self.enqueue_save) 25 topic_content_update.disconnect(self.enqueue_save)
26 26
27 def enqueue_save(self, sender, **kwargs):
28 return self.enqueue('update', sender)
29
27 def can_index(self, instance): 30 def can_index(self, instance):
28 return instance.forum.id in Forum.objects.public_forum_ids() 31 return instance.forum.id in Forum.objects.public_forum_ids()
29 32
30 33
31 class PostIndex(CondQueuedSearchIndex): 34 class PostIndex(CondQueuedSearchIndex):
44 post_content_update.connect(self.enqueue_save) 47 post_content_update.connect(self.enqueue_save)
45 48
46 def _teardown_save(self, model): 49 def _teardown_save(self, model):
47 post_content_update.disconnect(self.enqueue_save) 50 post_content_update.disconnect(self.enqueue_save)
48 51
52 def enqueue_save(self, sender, **kwargs):
53 return self.enqueue('update', sender)
54
49 def can_index(self, instance): 55 def can_index(self, instance):
50 return instance.topic.forum.id in Forum.objects.public_forum_ids() 56 return instance.topic.forum.id in Forum.objects.public_forum_ids()
51 57
52 58
53 site.register(Topic, TopicIndex) 59 site.register(Topic, TopicIndex)