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 2016/02/06 21:23:26 UTC

svn commit: r1728879 - in /comdev/reporter.apache.org/trunk: README.txt site/chi.py

Author: sebb
Date: Sat Feb  6 20:23:26 2016
New Revision: 1728879

URL: http://svn.apache.org/viewvc?rev=1728879&view=rev
Log:
Use https://whimsy.apache.org/public/committee-info.json instead of PAO data file

Modified:
    comdev/reporter.apache.org/trunk/README.txt
    comdev/reporter.apache.org/trunk/site/chi.py

Modified: comdev/reporter.apache.org/trunk/README.txt
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/README.txt?rev=1728879&r1=1728878&r2=1728879&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/README.txt (original)
+++ comdev/reporter.apache.org/trunk/README.txt Sat Feb  6 20:23:26 2016
@@ -92,9 +92,7 @@ Note: the prefix ~pao means that the fil
   data/pmcs.json
   data/projects.json
   data/releases/%s.json % project
-  ~pao/site/json/foundation/pmcs.json
-  ~pao/site/json/foundation/chairs.json
-  ~pao/site/json/projects/%s.json % project
+  https://whimsy.apache.org/public/committee-info.json
 
 - getjson.py
   data/health.json

Modified: comdev/reporter.apache.org/trunk/site/chi.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/chi.py?rev=1728879&r1=1728878&r2=1728879&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/chi.py (original)
+++ comdev/reporter.apache.org/trunk/site/chi.py Sat Feb  6 20:23:26 2016
@@ -2,6 +2,26 @@
 import os, re, json, subprocess, time
 import urllib2, cgi
 
+import sys
+sys.path.append("../scripts") # module is in sibling directory
+from urlutils import UrlCache
+
+uc = UrlCache(interval=0, silent=True)
+
+def loadJson(url):
+    resp = uc.get(url, name=None, encoding='utf-8', errors=None)
+    try:
+        content = resp.read() # json.load() does this anyway
+        try:
+            j = json.loads(content)
+        except Exception as e:
+            # The Proxy error response is around 4800 bytes
+            print("Error parsing response:\n%s" % content[0:4800])
+            raise e
+    finally:
+        resp.close()
+    return j
+
 form = cgi.FieldStorage();
 oproject = form['only'].value if ('only' in form and len(form['only'].value) > 0) else None
 
@@ -17,35 +37,6 @@ ldapmap = {
     'webservices': 'ws'
 }
 
-
-def getProjectData(project):
-    try:
-        y = []
-        with open("/var/www/projects.apache.org/site/json/projects/%s.json" % project, "r") as f:
-            x = json.loads(f.read())
-            f.close()
-            with open("/var/www/projects.apache.org/site/json/foundation/pmcs.json", "r") as f:
-                p = json.loads(f.read())
-                f.close()
-                for xproject in p:
-                    y.append(xproject)
-                    if xproject == project:
-                        x['name'] = p[project]['name']
-
-        return x, y;
-    except:
-        x = {}
-        y = []
-        with open("/var/www/projects.apache.org/site/json/foundation/pmcs.json", "r") as f:
-            p = json.loads(f.read())
-            f.close()
-            for xproject in p:
-                y.append(xproject)
-                if xproject == project:
-                    x['name'] = p[project]['name']
-
-        return x,y
-
 def getReleaseData(project):
     try:
         with open("/var/www/reporter.apache.org/data/releases/%s.json" % project, "r") as f:
@@ -112,7 +103,15 @@ if m:
         allpmcs = []
         keys = {}
         count = {}
-        foo, allpmcs = getProjectData('httpd')
+        c_info = loadJson('https://whimsy.apache.org/public/committee-info.json')['committees']
+        allpmcs = []
+        for ctte in c_info.keys():
+            if c_info[ctte]['pmc']:
+                if ctte == 'ws': 
+                    ctte = 'webservices'
+                    # hack
+                    c_info['webservices'] = c_info['ws']
+                allpmcs.append(ctte)
         npmcs = {}
         ncoms = {}
         names = {}
@@ -127,8 +126,8 @@ if m:
                 count[group][0] = len(pchanges[xgroup])
             if xgroup in cchanges:
                 count[group][1] = len(cchanges[xgroup])
-            ddata, bleh = getProjectData(group)
-            names[group] = ddata['name'] if 'name' in ddata else group
+            ddata = c_info[group]
+            names[group] = 'Apache ' + ddata['display_name'] if 'display_name' in ddata else group
             rdata[group] = getReleaseData(group) 
             cdata[group] = cdata[xgroup] if xgroup in cdata else {'pmc': {}, 'committer': {}}