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/10/11 02:18:19 UTC
svn commit: r1707937 - /comdev/reporter.apache.org/trunk/site/addrelease.py
Author: sebb
Date: Sun Oct 11 00:18:19 2015
New Revision: 1707937
URL: http://svn.apache.org/viewvc?rev=1707937&view=rev
Log:
Better handling of IO Errors
Modified:
comdev/reporter.apache.org/trunk/site/addrelease.py
Modified: comdev/reporter.apache.org/trunk/site/addrelease.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/site/addrelease.py?rev=1707937&r1=1707936&r2=1707937&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/site/addrelease.py (original)
+++ comdev/reporter.apache.org/trunk/site/addrelease.py Sun Oct 11 00:18:19 2015
@@ -40,6 +40,7 @@ def getReleaseData(committee):
return {}
saved = False
+err = None
committees = getPMCs(user)
if date != None and version and committee:
if committee in committees or isMember(user):
@@ -49,18 +50,25 @@ if date != None and version and committe
else: # it's 1970-01-01
if version in rdata:
del rdata[version]
- with open("/var/www/reporter.apache.org/data/releases/%s.json" % committee, "w") as f:
- json.dump(rdata, f, indent=1, sort_keys=True)
- f.close()
- saved = True
- if dojson:
- print("Content-Type: application/json\r\n\r\n")
- print(json.dumps({'versions': rdata}, indent=1))
- else:
- print("Content-Type: text/html\r\n\r\n<h3>Data submitted!</h3>You may see the updated committee data at: <a href='https://reporter.apache.org/?%s'>https://reporter.apache.org/?%s</a>." % (committee, committee))
+ try:
+ with open("/var/www/reporter.apache.org/data/releases/%s.json" % committee, "w") as f:
+ json.dump(rdata, f, indent=1, sort_keys=True)
+ f.close()
+ saved = True
+ if dojson:
+ print("Content-Type: application/json\r\n\r\n")
+ print(json.dumps({'versions': rdata}, indent=1))
+ else:
+ print("Content-Type: text/html\r\n\r\n<h3>Data submitted!</h3>You may see the updated committee data at: <a href='https://reporter.apache.org/?%s'>https://reporter.apache.org/?%s</a>." % (committee, committee))
+ except Exception as e:
+ err = e
if not saved:
if dojson:
- print("Content-Type: application/json\r\n\r\n{\"error\": \"Not saved\"}")
+ print("Content-Type: application/json\r\n\r\n")
+ print(json.dumps({'status': str(err)}))
else:
- print("Content-Type: text/plain\r\n\r\nCould not save. Make sure you have filled out all fields and have access to this committee data! For further inquiries, please contact dev@community.apache.org")
+ print("Content-Type: text/plain\r\n\r\n")
+ print("Could not save. Make sure you have filled out all fields and have access to this committee data! For further inquiries, please contact dev@community.apache.org")
+ if not err == None:
+ print("Error: %s " % str(err))