Log In
New Account
  
Home My Page Project Cloud Code Snippets Project Openings Hermes
Summary Lists News SCM
authorAndrew Flegg <andrew@bleb.org>
Thu, 30 Dec 2010 16:39:30 +0000 (16:39 +0000)
committerAndrew Flegg <andrew@bleb.org>
Sun, 2 Jan 2011 19:53:46 +0000 (19:53 +0000)
package/src/org/maemo/hermes/engine/facebook/service.py
package/src/org/maemo/hermes/engine/linkedin/api.py
package/src/org/maemo/hermes/engine/twitter/service.py
package/src/org/maemo/hermes/gui/gtkui.py

index ff46c26..0e5c1c9 100644 (file)
@@ -78,23 +78,28 @@ class Service(org.maemo.hermes.engine.service.Service):
             if key in data and data[key]:
                 callback(data[key])
         
-        friends_data = self.fb.get_friends()
-        for data in friends_data:
-            friend = Friend(data['name'])
-        
-            if 'link' not in data:
-                data['link'] = "http://www.facebook.com/profile.php?id=" + str(data['id'])
-        
-            if_defined(data, 'website', friend.add_url)
-            if_defined(data, 'link', friend.add_url)
-            if_defined(data, 'birthday', friend.set_birthday_date)
-
-            if_defined(data, 'picture', friend.set_photo_url)
+        try:
+            friends_data = self.fb.get_friends()
+            for data in friends_data:
+                friend = Friend(data['name'])
             
-            url = data['link']
-            friend.add_url(url)
-            self._register_friend(friend)
-
+                if 'link' not in data:
+                    data['link'] = "http://www.facebook.com/profile.php?id=" + str(data['id'])
+            
+                if_defined(data, 'website', friend.add_url)
+                if_defined(data, 'link', friend.add_url)
+                if_defined(data, 'birthday', friend.set_birthday_date)
+    
+                if_defined(data, 'picture', friend.set_photo_url)
+                
+                url = data['link']
+                friend.add_url(url)
+                self._register_friend(friend)
+        except Exception, e:
+            if e.message == 'Unauthorised':
+                raise org.maemo.hermes.engine.service.CredentialsExpiredException('Facebook')
+            else:
+                raise e
 
     # -----------------------------------------------------------------------
     def process_contact(self, contact):
index 363b2e9..06d9794 100644 (file)
@@ -131,7 +131,7 @@ class LinkedInApi():
             except:
                 pass
             if details.startswith('([unauth'):
-                raise CredentialsExpiredException('linkedin')
+                raise CredentialsExpiredException('LinkedIn')
             else:
                 raise Exception("LinkedIn communication errors detected" + details)
         
index 1343b7a..2aae729 100644 (file)
@@ -87,6 +87,11 @@ class Service(org.maemo.hermes.engine.service.Service):
                 return []
             else:
                 raise e
+        except Exception, e:
+            if e.message == 'This method requires authentication.':
+                raise org.maemo.hermes.engine.service.CredentialsExpiredException('Twitter')
+            else:
+                raise e
         
     
     
index 001c456..c7b8c86 100644 (file)
@@ -147,7 +147,7 @@ class HermesGUI(WimpWorks):
                 gobject.idle_add(self.report_error, _('Network connection error. Check connectivity.'))
                 
             except CredentialsExpiredException, e:
-                gobject.idle_add(self.report_error, _('Credentials expired. Please reauthorise: ') + e.message)
+                gobject.idle_add(self.report_error, _('Credentials expired. Please reauthorise %s.') % (e.message))
           
             except Exception, e:
                 traceback.print_exc()

Terms of Use    Privacy Policy    Contribution Guidelines    Feedback

Powered By GForge Collaborative Development Environment