1
2 """
3 An OptionParser which accepts a single string as input and raise an exception
4 instead of calling sys.exit() in case of error
5
6 Kindly borrowed from Yokadi Option parser (http://github.com/agateau/yokadi/)
7 @author: Aurélien Gâteau <aurelien.gateau@free.fr>
8 @author: Sébastien Renard <Sebastien.Renard@sigitalfox.org>
9
10 @license: GNU GPL V3
11 """
12 from optparse import OptionParser
13 import sys
14 from pysqlexception import PysqlException, PysqlOptionParserNormalExitException
15
16
19 OptionParser.__init__(self, add_help_option=False)
20
22 argv = line.split(u" ")
23
24 if argv == [u""]:
25 argv = []
26
27
28 argv = [i for i in argv if i is not u""]
29
30 return OptionParser.parse_args(self, argv)
31
32 - def exit(self, status=0, msg=None):
39
43