django-avatar
django-avatar copied to clipboard
When a user is not found, get_primary_avatar() returns a string instead of an avatar object.
When the below code is run (which results if you pass in a user that doesn't exist... I put User ID instead of username in the render_primary view) it will return a "default url" which is a string. The view then tries to use the result as if it was an avatar object and it ... explodes.
avatar.util on tip
def get_primary_avatar(user, size=80): if not isinstance(user, User): try: user = User.objects.get(username=user) except User.DoesNotExist: return get_default_avatar_url() # <~~~ inappropriate return type.
You're right, I fixed it in http://github.com/liberation/django-avatar/commit/47a3856e8e50fd6fd984c7676885b40d586a4629
Working on the corresponding tests to make sure it doesn't happen again.
Has been fixed.