Skip to content

Commit

Permalink
Fixes #364 , ignore trailing equal signs in split
Browse files Browse the repository at this point in the history
  • Loading branch information
wilke committed Aug 10, 2016
1 parent d1df346 commit 42f8c59
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions scripts/Tools/xmlchange
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,13 @@ def xmlchange(caseroot, listofsettings=None, xmlfile=None, xmlid=None, xmlval=No
append=None, noecho=False, warn=None, force=False):
with Case(caseroot, read_only=False) as case:
if len(listofsettings):
logger.warning("List of attributes to change: %s" , listofsettings)
logger.debug("List of attributes to change: %s" , listofsettings)

# Error handling, exit with grace if xmlval or equal sign is missing. Check first all attributes before changing
for setting in listofsettings:
# Test for equal sign
pair = setting.split("=")
expect(len(pair) == 2 , "Wrong format for %s. Expecting a key value pair in form of key=value." % (setting) )
(xmlid, xmlval) = pair

# Change values
for setting in listofsettings:

pair = setting.split("=")
expect(len(pair) == 2 , "Expecting a key value pair in the form of key=value.")
pair = setting.split("=",1)
expect(len(pair) == 2 , "Expecting a key value pair in the form of key=value. Got %s" % (pair) )
(xmlid, xmlval) = pair

type_str = case.get_type_info(xmlid)
Expand Down

0 comments on commit 42f8c59

Please sign in to comment.