Mercurial > public > sg101
comparison gpp/bio/signals.py @ 471:d83296cac940
For #227: only enqueue user profiles if the user has changed the content we have in the search index.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Wed, 17 Aug 2011 02:02:20 +0000 |
parents | 47f4259ce511 |
children | 98b373ca09f3 |
comparison
equal
deleted
inserted
replaced
470:d9b6c4ec1977 | 471:d83296cac940 |
---|---|
1 """ | 1 """ |
2 Signal handler(s) for the bio application. | 2 Signal handlers & signals for the bio application. |
3 | |
3 """ | 4 """ |
4 from django.db.models.signals import post_save | 5 from django.db.models.signals import post_save |
5 from django.contrib.auth.models import User | 6 from django.contrib.auth.models import User |
7 import django.dispatch | |
6 | 8 |
7 import bio.badges | 9 import bio.badges |
8 from bio.models import UserProfile | 10 from bio.models import UserProfile |
9 from donations.models import Donation | 11 from donations.models import Donation |
10 from weblinks.models import Link | 12 from weblinks.models import Link |
89 post_save.connect(on_donation_save, sender=Donation, dispatch_uid='bio.signals') | 91 post_save.connect(on_donation_save, sender=Donation, dispatch_uid='bio.signals') |
90 post_save.connect(on_link_save, sender=Link, dispatch_uid='bio.signals') | 92 post_save.connect(on_link_save, sender=Link, dispatch_uid='bio.signals') |
91 post_save.connect(on_download_save, sender=Download, dispatch_uid='bio.signals') | 93 post_save.connect(on_download_save, sender=Download, dispatch_uid='bio.signals') |
92 post_save.connect(on_story_save, sender=Story, dispatch_uid='bio.signals') | 94 post_save.connect(on_story_save, sender=Story, dispatch_uid='bio.signals') |
93 post_save.connect(on_photo_save, sender=Photo, dispatch_uid='bio.signals') | 95 post_save.connect(on_photo_save, sender=Photo, dispatch_uid='bio.signals') |
96 | |
97 # Signals for the bio application | |
98 # | |
99 # This signal is sent whenever a profile has had its textual content updated. | |
100 # The provided arguments to the receiver function are: | |
101 # - sender - the profile model instance | |
102 | |
103 profile_content_update = django.dispatch.Signal(providing_args=[]) | |
104 | |
105 | |
106 def notify_profile_content_update(profile): | |
107 """ | |
108 Convenience function to send the profile content update signal. | |
109 | |
110 """ | |
111 profile_content_update.send_robust(profile) |