You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by ni...@apache.org on 2010/06/04 18:22:55 UTC
svn commit: r951474 - /comdev/nearby_people/nearby/foaf.py
Author: nick
Date: Fri Jun 4 16:22:54 2010
New Revision: 951474
URL: http://svn.apache.org/viewvc?rev=951474&view=rev
Log:
Give warnings in the logs if we don't have all the data for someone
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=951474&r1=951473&r2=951474&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Fri Jun 4 16:22:54 2010
@@ -113,6 +113,10 @@ class FOAF(object):
surname = surnameN[0].firstChild.data
if nameN:
name = nameN[0].firstChild.data
+ # Some people store everything in this field
+ if not surnameN and name.find(" ") > 0:
+ surname = " ".join( name.split(" ")[1:] )
+ name = name.split(" ")[0]
if longN:
long = longN[0].firstChild.data
if latN:
@@ -175,10 +179,24 @@ class FOAF(object):
weblogs.append({"title": title, "url": url})
# Finish building up
- if name and surname and uid and lat and long:
+ missing = []
+ if not name:
+ missing.append("name")
+ if not surname:
+ missing.append("surname")
+ if not uid:
+ missing.append("uid")
+ if not lat:
+ missing.append("lat")
+ if not long:
+ missing.append("long")
+
+ if not missing:
self.people[name] = {
"name": name, "surname": surname,
"uid":uid, "email": email,
"latitude": lat, "longitude": long, "projects": projects,
"avatar": depiction, "weblogs": weblogs
}
+ else:
+ sys.stderr.write("Skipping %s due to missing %s\n" % (filename,missing))