From: Sven Velt Date: Wed, 13 Jan 2010 22:09:55 +0000 (+0100) Subject: Move encoding check to "nagixsc.py" X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=c69d680173ea085aa553e4e50c055dbbd842e78c;p=nagixsc.git Move encoding check to "nagixsc.py" --- 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) ##############################################################################