Mercurial > hgweb.cgi > hwm
changeset 1:7eab9081bd86
Handle error when configuration file isn't accessible. IN: -
author | John Schneiderman <JohnMS@CodeGNU.com> |
---|---|
date | Mon, 21 Jul 2014 20:54:24 -0500 |
parents | a69d147ccf1c |
children | 3f42faf8f864 |
files | src/manager.py |
diffstat | 1 files changed, 8 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/manager.py Mon Jul 21 20:05:30 2014 -0500 +++ b/src/manager.py Mon Jul 21 20:54:24 2014 -0500 @@ -77,6 +77,12 @@ exit(repoStoreStatus) # Add the new repository to the web register. - with open(settings.HgWebPath + os.sep + "hgweb.config", "a") as hgweb: - hgweb.write('\n' + repository.StorageName + " = " + repoBase) + try: + with open(settings.HgWebPath + os.sep + "hgweb.config", "a") as hgweb: + hgweb.write('\n' + repository.StorageName + " = " + repoBase) + except IOError as e: + print >>sys.stderr, "Web Configuration error({0}): {1}".format(e.errno, e.strerror) + os.chmod(config, stat.S_IWRITE) + shutil.rmtree(repoBase) + return False return True