community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r1520756 - /comdev/nearby_people/nearby/foaf.py
Date Sat, 07 Sep 2013 10:54:26 GMT
Author: nick
Date: Sat Sep  7 10:54:26 2013
New Revision: 1520756

URL: http://svn.apache.org/r1520756
Log:
More error handling - remote server with FOAF file might be down too

Modified:
    comdev/nearby_people/nearby/foaf.py

Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=1520756&r1=1520755&r2=1520756&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Sat Sep  7 10:54:26 2013
@@ -89,9 +89,12 @@ class FOAF(object):
                   sys.stderr.write("Missing FOAF file %s\n" % people_rel_uri)
             else:
                 file = None
-                usock = urllib.urlopen(uri)
-                self._parse_foaf(usock, uri)
-                usock.close()        
+                try:
+                   usock = urllib.urlopen(uri)
+                   self._parse_foaf(usock, uri)
+                   usock.close()        
+                except IOError, e:
+                   sys.stderr.write("Skipping %s due to broken server: %s\n" % (uri,e))
                 
         self.updated_at = datetime.datetime.utcnow()
         
@@ -108,7 +111,7 @@ class FOAF(object):
             
         try:
            foaf = parse(data)
-        except Exception as e:
+        except Exception, e:
            sys.stderr.write("Skipping %s due to invalid/corrupt file: %s\n" % (filename,e))
            return None
 



Mime
View raw message