in add_user_profile_attributes handle SiteProfileNotAvailable as advised by django documentation

This commit is contained in:
Benjamin Dauvergne 2011-09-05 16:36:56 +02:00
parent a9eb81ee46
commit 3a2c6b370f
1 changed files with 2 additions and 1 deletions

View File

@ -1,5 +1,6 @@
from django.core.exceptions import ObjectDoesNotExist
from django.dispatch import Signal
from django.contrib.auth.models import SiteProfileNotAvailable
'''authorize_decision
Expect a dictionnaries as return with:
@ -37,7 +38,7 @@ def add_user_profile_attributes(request, user, audience, **kwargs):
if value is not None or value == '':
attributes[field_name] = [ value ]
return { 'attributes': attributes }
except ObjectDoesNotExist:
except (ObjectDoesNotExist, SiteProfileNotAvailable):
return { 'attributes': dict() }
add_attributes_to_response.connect(add_user_profile_attributes)