Mercurial > public > sg101
comparison gpp/forums/signals.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 | 82b97697312e |
comparison
equal
deleted
inserted
replaced
469:3b30286adba5 | 470:d9b6c4ec1977 |
---|---|
72 # Signals for the forums application. | 72 # Signals for the forums application. |
73 # | 73 # |
74 # This signal is sent when a topic has had its textual content (title) changed. | 74 # This signal is sent when a topic has had its textual content (title) changed. |
75 # The provided arguments are: | 75 # The provided arguments are: |
76 # sender - the topic model instance | 76 # sender - the topic model instance |
77 # instance - the topic model instance | |
78 # created - True if the topic is new, False if updated | 77 # created - True if the topic is new, False if updated |
79 | 78 |
80 topic_content_update = django.dispatch.Signal(providing_args=['action']) | 79 topic_content_update = django.dispatch.Signal(providing_args=['created']) |
81 | 80 |
82 # This signal is sent when a post has had its textual content (body) changed. | 81 # This signal is sent when a post has had its textual content (body) changed. |
83 # The provided arguments are: | 82 # The provided arguments are: |
84 # sender - the post model instance | 83 # sender - the post model instance |
85 # instance - the topic model instance | |
86 # created - True if the post is new, False if updated | 84 # created - True if the post is new, False if updated |
87 | 85 |
88 post_content_update = django.dispatch.Signal(providing_args=['action']) | 86 post_content_update = django.dispatch.Signal(providing_args=['created']) |
89 | 87 |
90 | 88 |
91 def notify_new_topic(topic): | 89 def notify_new_topic(topic): |
92 """ | 90 """ |
93 Sends the topic_content_update signal for a new topic instance. | 91 Sends the topic_content_update signal for a new topic instance. |
94 | 92 |
95 """ | 93 """ |
96 topic_content_update.send_robust(topic, instance=topic, created=True) | 94 topic_content_update.send_robust(topic, created=True) |
97 | 95 |
98 | 96 |
99 def notify_updated_topic(topic): | 97 def notify_updated_topic(topic): |
100 """ | 98 """ |
101 Sends the topic_content_update signal for an updated topic instance. | 99 Sends the topic_content_update signal for an updated topic instance. |
102 | 100 |
103 """ | 101 """ |
104 topic_content_update.send_robust(topic, instance=topic, created=False) | 102 topic_content_update.send_robust(topic, created=False) |
105 | 103 |
106 | 104 |
107 def notify_new_post(post): | 105 def notify_new_post(post): |
108 """ | 106 """ |
109 Sends the post_content_update signal for a new post instance. | 107 Sends the post_content_update signal for a new post instance. |
110 | 108 |
111 """ | 109 """ |
112 post_content_update.send_robust(post, instance=post, created=True) | 110 post_content_update.send_robust(post, created=True) |
113 | 111 |
114 | 112 |
115 def notify_updated_post(post): | 113 def notify_updated_post(post): |
116 """ | 114 """ |
117 Sends the post_content_update signal for an updated post instance. | 115 Sends the post_content_update signal for an updated post instance. |
118 | 116 |
119 """ | 117 """ |
120 post_content_update.send_robust(post, instance=post, created=False) | 118 post_content_update.send_robust(post, created=False) |