Skip to content

Commit

Permalink
Move test for empty keygroup to address issue in #4
Browse files Browse the repository at this point in the history
  • Loading branch information
uiri committed Mar 5, 2013
1 parent ffa0d09 commit e9aae49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def loads(s):
if line[1].strip() != "":
raise Exception("Key group not on a line by itself.")
line = line[0]
if line == "":
raise Exception("Can't have a keygroup with an empty name")
groups = line.split('.')
currentlevel = retval
for i in xrange(len(groups)):
group = groups[i]
if group == "":
raise Exception("Can't have a keygroup with an empty name")
try:
currentlevel[group]
if i == len(groups) - 1:
Expand All @@ -72,6 +72,7 @@ def loads(s):
elif "=" in line:
pair = line.split('=', 1)
if pair[0] == pair[0].rstrip():
print pair[0]
raise Exception("Missing whitespace between key name and =")
pair[0] = pair[0].strip()
pair[1] = pair[1].strip()
Expand Down

0 comments on commit e9aae49

Please sign in to comment.