Fix handling of incorrect option specifications

This commit is contained in:
Grigori Goronzy 2014-01-13 02:01:29 +01:00
parent ddd5ec4e57
commit fad3147e71

View File

@ -1574,10 +1574,11 @@ class StcGal:
def emit_options(self, options): def emit_options(self, options):
for o in options: for o in options:
try: try:
k, v = o.split("=", 1) kv = o.split("=", 1)
self.protocol.set_option(k, v) if len(kv) < 2: raise ValueError("incorrect format")
self.protocol.set_option(kv[0], kv[1])
except ValueError as e: except ValueError as e:
raise NameError("invalid option '%s' (%s)" % (k, e)) raise NameError("invalid option '%s' (%s)" % (kv[0], e))
def run(self): def run(self):
try: self.protocol.connect() try: self.protocol.connect()