[kupfer: 1/6] gmail: add protection for missing contact images



commit f5b44f182afb3e6b1b32a2fdc3eccf1fd85807ca
Author: Karol BÄdkowski <karol bedkowski gmail com>
Date:   Sat Nov 12 11:17:18 2011 +0100

    gmail: add protection for missing contact images
    
    Without this patch, error until loading contact photo breaking loading
    other contacts.

 kupfer/plugin/gmail/__init__.py |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/gmail/__init__.py b/kupfer/plugin/gmail/__init__.py
index 6d45c6b..42b7af4 100644
--- a/kupfer/plugin/gmail/__init__.py
+++ b/kupfer/plugin/gmail/__init__.py
@@ -106,7 +106,11 @@ def get_contacts():
 				if email.address:
 					image = None
 					if __kupfer_settings__['loadicons']:
-						image = gd_client.GetPhoto(entry)
+						# Sometimes GetPhoto can't find appropriate image (404)
+						try:
+							image = gd_client.GetPhoto(entry)
+						except:
+							pass
 					email = email.address
 					contacts.append(GoogleContact(email, common_name or email,
 							image))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]