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