diff gpp/membermap/signals.py @ 46:0140ff687d49

Membermap bug: in the signal handler, if the user isn't on the map, just bail out.
author Brian Neal <bgneal@gmail.com>
date Sat, 20 Jun 2009 03:23:54 +0000
parents dbd703f7d63a
children 3a4bbf9c2cce
line wrap: on
line diff
--- a/gpp/membermap/signals.py	Fri Jun 19 03:16:03 2009 +0000
+++ b/gpp/membermap/signals.py	Sat Jun 20 03:23:54 2009 +0000
@@ -11,11 +11,13 @@
 def on_profile_save(sender, **kwargs):
     if 'instance' in kwargs:
         profile = kwargs['instance']
-        map_entry = MapEntry.objects.get(user=profile.user)
+        try:
+            map_entry = MapEntry.objects.get(user=profile.user)
+        except MapEntry.DoesNotExist:
+            # Not on the map, no harm, no foul
+            return
         if map_entry is not None:
             map_entry.save()
 
 
 post_save.connect(on_profile_save, sender=UserProfile)
-
-# vim: ts=4 sw=4