You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by se...@apache.org on 2015/09/22 23:06:54 UTC

svn commit: r1704727 - /comdev/projects.apache.org/scripts/committee_info.py

Author: sebb
Date: Tue Sep 22 21:06:52 2015
New Revision: 1704727

URL: http://svn.apache.org/viewvc?rev=1704727&view=rev
Log:
committe_info now fully processed

Modified:
    comdev/projects.apache.org/scripts/committee_info.py

Modified: comdev/projects.apache.org/scripts/committee_info.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/committee_info.py?rev=1704727&r1=1704726&r2=1704727&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/committee_info.py (original)
+++ comdev/projects.apache.org/scripts/committee_info.py Tue Sep 22 21:06:52 2015
@@ -61,7 +61,7 @@ def get_url_if_newer(url, dir, name):
 
     sinceTime = mod_date(fileTime)
     headers = {"If-Modified-Since" : sinceTime}
-    
+
     req = urllib.request.Request(URL, headers=headers)
     try:
         response = urllib.request.urlopen(req)
@@ -71,7 +71,7 @@ def get_url_if_newer(url, dir, name):
         with open(outFile,'wb') as f:
             f.write(response.read())
             f.close()
-        
+
         # store the last mod time as the time of the file
         os.utime(outFile, times=(lastModT, lastModT))
         os.rename(outFile, path) # seems to preserve file mod time
@@ -99,7 +99,7 @@ def chairs():
     committees = cidata['committees']
 
     chairjson={}
-    for ctte in committees:    
+    for ctte in committees:
         c = committees[ctte]
         if not c['pmc']:
             continue
@@ -112,6 +112,28 @@ def chairs():
 
     return chairjson
 
+"""
+Returns an array of entries of the form:
+
+    "abdera": {
+      "fullname": "Apache Abdera",
+      "mail_list": "abdera",
+      "established": "2008-11",
+      "report": [
+        "February",
+        "May",
+        "August",
+        "November"
+      ],
+       "reporting": 2,
+      "chair": {
+        "nick": "antelder",
+        "name": "Ant Elder"
+        },
+      "pmc": true
+      },
+
+"""
 def committees():
     update_cache()
 
@@ -119,6 +141,39 @@ def committees():
         cidata = json.loads(f.read())
         f.close()
 
-    committees = cidata['committees']
-
-    return committees    
\ No newline at end of file
+    committees = {}
+    cttes = cidata['committees']
+    for ent in cttes:
+        ctte = cttes[ent]
+        c = {}
+        for key in ctte:
+            # some keys need special processing
+            if key == 'display_name':
+                basename = ctte['display_name']
+                c['fullname'] = "Apache %s" % ('mod_perl' if basename == 'Perl' else basename)
+            elif key == 'chair':
+                c['chair'] = None
+                for ch in ctte['chair']:
+                    c['chair'] = {
+                    'nick': ch,
+                    'name': ctte['chair'][ch]['name']}
+            elif key == 'established':
+                value = ctte[key]
+                if value:
+                    value = "%s-%s" % (value[3:7], value[0:2]) # extract year and month
+                c[key] = value
+            elif key == 'report':
+                c[key] = ctte[key] # save original values
+                value = ctte[key]
+                if 'January' in value:
+                    c['reporting'] = 1
+                elif 'February' in value:
+                    c['reporting'] = 2
+                elif 'March' in value:
+                    c['reporting'] = 3
+                elif 'Every month' in value:
+                    c['reporting'] = 0
+            else:
+                c[key] = ctte[key]
+        committees[ent]=c
+    return committees
\ No newline at end of file