fix error message

This commit is contained in:
Martin Zimmermann 2014-06-15 17:04:52 +02:00
parent 33ce5959e9
commit 396eccfa00

View File

@ -2,7 +2,6 @@
import sys
import os
import os.path
import logging
from glob import glob
@ -47,19 +46,19 @@ class Dispatcher(DispatcherMiddleware):
resp = Response("\n".join(self.isso.keys()), 404, content_type="text/plain")
return resp(environ, start_response)
settings = os.environ.get("ISSO_SETTINGS")
settings = os.environ.get("ISSO_SETTINGS")
if settings:
if os.path.isdir(settings):
conf_glob = os.path.join(os.environ["ISSO_SETTINGS"], '*.cfg')
conf_glob = os.path.join(settings, '*.cfg')
confs = glob(conf_glob)
application = wsgi.SubURI(Dispatcher(*confs))
else:
confs = os.environ["ISSO_SETTINGS"].split(";")
confs = settings.split(";")
for path in confs:
if not os.path.isfile(path):
logger.fatal("%s: no such file", path)
sys.exit(1)
application = wsgi.SubURI(Dispatcher(*confs))
else:
logger.fatal('environment variable ISSO_SETTINGS or ISSO_SETTINGS_DIR must be set')
logger.fatal('environment variable ISSO_SETTINGS must be set')