incubator-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1181312 - /incubator/public/trunk/clutch.py
Date Tue, 11 Oct 2011 00:29:55 GMT
Author: sebb
Date: Tue Oct 11 00:29:55 2011
New Revision: 1181312

URL: http://svn.apache.org/viewvc?rev=1181312&view=rev
Log:
Update clutch to use podlings.xml instead of projects/index.xml

Modified:
    incubator/public/trunk/clutch.py

Modified: incubator/public/trunk/clutch.py
URL: http://svn.apache.org/viewvc/incubator/public/trunk/clutch.py?rev=1181312&r1=1181311&r2=1181312&view=diff
==============================================================================
--- incubator/public/trunk/clutch.py (original)
+++ incubator/public/trunk/clutch.py Tue Oct 11 00:29:55 2011
@@ -245,23 +245,14 @@ def getText(nodelist):
       rc = rc + node.data
   return rc
 
-print "Gather data from the projects-in-incubation table ..."
-dom = xml.dom.minidom.parse("site-author/projects/index.xml")
-# FIXME: dom.getElementById("current") ?
-table = dom.getElementsByTagName("table")[0]
-for row in table.getElementsByTagName("tr")[1:]:
-  try:
-    # try to get the link to their status report
-    name = getText(row.getElementsByTagName("td")[0].childNodes[1].childNodes)
-  except IndexError:
-    # try to get plain text name
-    name = getText(row.getElementsByTagName("td")[0].childNodes)
-    fileBaseName = ""
-  else:
-    statusFileStr = row.getElementsByTagName("td")[0].childNodes[1].attributes["href"].value
-    (dirName, fileName) = os.path.split(statusFileStr)
-    (fileBaseName, fileExtension) = os.path.splitext(fileName)
+# Parse the podlings data file
+dom = xml.dom.minidom.parse("site-author/podlings.xml")
 
+print "Gather data from the projects-in-incubation table ..."
+for row in dom.getElementsByTagName("podling"):
+ if row.getAttribute("status") == 'current':
+  name = row.getAttribute("name")
+  fileBaseName = row.getAttribute("resource")
   name = name.strip() # strip whitespace
   id = name.lower()
   #print "Name: %s" % name
@@ -270,8 +261,12 @@ for row in table.getElementsByTagName("t
   # FIXME: perhaps need to use resourceNames
   if 'manifoldcf' in id:
     id = 'manifoldcf'
-  values = [getText(td.childNodes) for td in row.getElementsByTagName("td")[1:]]
-  description, sponsor, mentors, startDate = values[:4]
+  startDate = row.getAttribute("startdate")
+  sponsor = row.getAttribute("sponsor")
+  description = getText(row.getElementsByTagName("description"))
+  mentors = row.getElementsByTagName("mentor")[0].firstChild.data
+  for mentor in row.getElementsByTagName("mentor")[1:]:
+    mentors += ', ' + mentor.firstChild.data
 
   try:
     projectsTable[id]
@@ -300,15 +295,10 @@ for row in table.getElementsByTagName("t
 
 print "Gather data from the projects-graduated table ..."
 graduatedProjects = {}
-table2 = dom.getElementsByTagName("table")[1]
-for row in table2.getElementsByTagName("tr")[1:]:
-  # FIXME: surely this can be improved
-  elementA = row.getElementsByTagName("td")[0].getElementsByTagName("a")[0]
-  if elementA.attributes.has_key('href'):
-    hrefGraduate = elementA.getAttribute('href')
-    matchGraduated = re.search(graduatedRE, hrefGraduate)
-    if matchGraduated:
-      graduatedProjects[matchGraduated.group(1).lower()] = True
+for row in dom.getElementsByTagName("podling"):
+  if row.getAttribute("status") == 'graduated':
+    resource = row.getAttribute("resource")
+    graduatedProjects[resource.lower()] = True
 
 dom.unlink()
 



---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@incubator.apache.org
For additional commands, e-mail: cvs-help@incubator.apache.org


Mime
View raw message