From 7351534f8868846378c442d27c3eeedd8ffc844e Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Tue, 2 Nov 2010 16:28:01 +0000 Subject: [PATCH] py-i2phosts-builder: use validate_config() --- py-i2phosts-builder | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/py-i2phosts-builder b/py-i2phosts-builder index 614a695..ff1edf4 100755 --- a/py-i2phosts-builder +++ b/py-i2phosts-builder @@ -18,7 +18,11 @@ parser.add_argument('-d', '--debug', action='store_true', args = parser.parse_args() # read config -config = configobj.ConfigObj(args.config_file, file_error=True) +spec = ''' + hostsfile = string(default=None) + ''' +spec = spec.split('\n') +config = configobj.ConfigObj(args.config_file, configspec=spec, file_error=True) if 'include' in config: config_included = configobj.ConfigObj(config['include']) config.merge(config_included) @@ -32,6 +36,10 @@ else: sys.path.insert(1, DJANGO_PROJECT_PATH) os.environ['DJANGO_SETTINGS_MODULE'] = DJANGO_SETTINGS_MODULE from web.postkey.models import i2phost +from web.lib.utils import validate_config + +# validate config +validate_config(config) # result hosts.txt if 'hostsfile' in config: