Added check on profile avatar
authorThierry Florac <thierry.florac@onf.fr>
Wed, 12 Jul 2017 12:11:25 +0200
changeset 13 c05c7737c8da
parent 12 33406f9b6cc7
child 14 1c9f8ee7c072
Added check on profile avatar
src/pyams_notify/event.py
--- a/src/pyams_notify/event.py	Wed Jun 07 09:34:17 2017 +0200
+++ b/src/pyams_notify/event.py	Wed Jul 12 12:11:25 2017 +0200
@@ -67,10 +67,10 @@
             principal_id = self.request.principal.id
         principal = get_principal(self.request, principal_id)
         self.source = {'id': principal.id,
-                       'title': principal.title,
-                       'avatar': absolute_url(IPublicProfile(principal).avatar,
-                                              self.request,
-                                              '++thumb++square:32x32.png')}
+                       'title': principal.title}
+        profile = IPublicProfile(principal)
+        if profile.avatar:
+            self.source['avatar'] = absolute_url(profile.avatar, self.request, '++thumb++square:32x32.png')
         configuration = IBackOfficeConfiguration(self.request.root)
         self.title = '{0} - {1}'.format(configuration.short_title, principal.title)