community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hbout...@apache.org
Subject svn commit: r1689127 - /comdev/projects.apache.org/scripts/import/parseprojects.py
Date Sat, 04 Jul 2015 09:22:43 GMT
Author: hboutemy
Date: Sat Jul  4 09:22:43 2015
New Revision: 1689127

URL: http://svn.apache.org/r1689127
Log:
when parse errors found, parse only rdf in error

Modified:
    comdev/projects.apache.org/scripts/import/parseprojects.py

Modified: comdev/projects.apache.org/scripts/import/parseprojects.py
URL: http://svn.apache.org/viewvc/comdev/projects.apache.org/scripts/import/parseprojects.py?rev=1689127&r1=1689126&r2=1689127&view=diff
==============================================================================
--- comdev/projects.apache.org/scripts/import/parseprojects.py (original)
+++ comdev/projects.apache.org/scripts/import/parseprojects.py Sat Jul  4 09:22:43 2015
@@ -5,7 +5,12 @@ import json
 import os
 import traceback
 
-with open("../../data/projects.xml", "r") as f:
+projectsList = "../../data/projects.xml";
+save = True;
+if os.path.exists("parseprojects-failures.xml"):
+    projectsList = "parseprojects-failures.xml";
+    save = False;
+with open(projectsList, "r") as f:
     data  = f.read()
     f.close()
 xmldoc = minidom.parseString(data)
@@ -141,13 +146,14 @@ for s in itemlist :
             f.write(rdf)
             f.close()
 
-print("Writing foundation/projects.json...")
-with open ("../../site/json/foundation/projects.json", "w") as f:
-    f.write(json.dumps(projects, sort_keys=True, indent=0))
-    f.close()
+if save:
+    print("Writing foundation/projects.json...")
+    with open ("../../site/json/foundation/projects.json", "w") as f:
+        f.write(json.dumps(projects, sort_keys=True, indent=0))
+        f.close()
 
 if len(failures) > 0:
-    with open ("rdfparse-failures.xml", "w") as f:
+    with open ("parseprojects-failures.xml", "w") as f:
         f.write("<doapFiles>\n")
         for fail in failures:
             f.write("<location>%s</location>\n" % fail)



Mime
View raw message