Skip to content

Commit

Permalink
comment out values of None without crashing, toml-lang/toml#30
Browse files Browse the repository at this point in the history
  • Loading branch information
ntrepid8 committed Oct 5, 2015
1 parent b5a7062 commit b4fe7d0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pytoml/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ def dump(fout, obj):
tables.append((name + (k,), v, False))
elif isinstance(v, list) and v and all(isinstance(o, dict) for o in v):
tables.extend((name + (k,), d, True) for d in reversed(v))
elif v is None:
fout.write(
'#{} = VALUE # To use: uncomment and replace VALUE with your own value.\n'.format(_escape_id(k)))
else:
fout.write('{} = {}\n'.format(_escape_id(k), _format_value(v)))

Expand Down

0 comments on commit b4fe7d0

Please sign in to comment.