diff 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
line wrap: on
line diff
--- a/gpp/bio/signals.py	Wed Aug 17 01:29:27 2011 +0000
+++ b/gpp/bio/signals.py	Wed Aug 17 02:02:20 2011 +0000
@@ -1,8 +1,10 @@
 """
-Signal handler(s) for the bio application.
+Signal handlers & signals for the bio application.
+
 """
 from django.db.models.signals import post_save
 from django.contrib.auth.models import User
+import django.dispatch
 
 import bio.badges
 from bio.models import UserProfile
@@ -91,3 +93,19 @@
 post_save.connect(on_download_save, sender=Download, dispatch_uid='bio.signals')
 post_save.connect(on_story_save, sender=Story, dispatch_uid='bio.signals')
 post_save.connect(on_photo_save, sender=Photo, dispatch_uid='bio.signals')
+
+# Signals for the bio application
+#
+# This signal is sent whenever a profile has had its textual content updated.
+# The provided arguments to the receiver function are:
+#   - sender - the profile model instance
+
+profile_content_update = django.dispatch.Signal(providing_args=[])
+
+
+def notify_profile_content_update(profile):
+    """
+    Convenience function to send the profile content update signal.
+
+    """
+    profile_content_update.send_robust(profile)