mirror of
https://git.linux-kernel.at/oliver/ivatar.git
synced 2025-11-18 05:58:02 +00:00
Error when trying to fetch with openid
This commit is contained in:
@@ -26,10 +26,12 @@ class AvatarImageView(TemplateView):
|
|||||||
else:
|
else:
|
||||||
raise Exception('Digest provided is wrong: %s' % kwargs['digest'])
|
raise Exception('Digest provided is wrong: %s' % kwargs['digest'])
|
||||||
|
|
||||||
email = model.objects.get(digest=kwargs['digest'])
|
obj = model.objects.get(digest=kwargs['digest'])
|
||||||
if not email.photo:
|
if not obj.photo:
|
||||||
raise Exception('No photo assigned to "%s"' % email.email)
|
# That is hacky, but achieves what we want :-)
|
||||||
|
attr = getattr(obj, 'email', obj.openid)
|
||||||
|
raise Exception('No photo assigned to "%s"' % attr)
|
||||||
|
|
||||||
return HttpResponse(
|
return HttpResponse(
|
||||||
io.BytesIO(email.photo.data),
|
io.BytesIO(obj.photo.data),
|
||||||
content_type='image/%s' % email.photo.format)
|
content_type='image/%s' % obj.photo.format)
|
||||||
|
|||||||
Reference in New Issue
Block a user