From c69d680173ea085aa553e4e50c055dbbd842e78c Mon Sep 17 00:00:00 2001 From: Sven Velt Date: Wed, 13 Jan 2010 23:09:55 +0100 Subject: [PATCH] Move encoding check to "nagixsc.py" --- nagixsc.py | 7 +++++++ nagixsc_conf2xml.py | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/nagixsc.py b/nagixsc.py index d65aa09..c5d8712 100644 --- a/nagixsc.py +++ b/nagixsc.py @@ -16,6 +16,13 @@ def available_encodings(): return ['base64', 'plain',] +def check_encoding(enc): + if enc in available_encodings(): + return True + else: + return False + + def decode(data, encoding): if encoding == 'plain': return data diff --git a/nagixsc_conf2xml.py b/nagixsc_conf2xml.py index 42ebcbc..a5f3f13 100755 --- a/nagixsc_conf2xml.py +++ b/nagixsc_conf2xml.py @@ -33,9 +33,9 @@ parser.set_defaults(verb=0) ############################################################################## -if options.encoding not in available_encodings(): +if not check_encoding(options.encoding): print 'Wrong encoding method "%s"!' % options.encoding - print 'Could be one of: %s' % ', '.join(available_encodings) + print 'Could be one of: "%s"' % '", "'.join(available_encodings()) sys.exit(127) ############################################################################## -- 2.30.2