--- a/pvl/dhcp/config.py Mon Mar 02 12:54:27 2015 +0200
+++ b/pvl/dhcp/config.py Mon Mar 02 12:59:17 2015 +0200
@@ -313,17 +313,21 @@
if block.comment:
yield build_line((), end="# {comment}".format(comment=block.comment), indent=indent)
-
- yield build_line(block.key, end=' {', indent=indent, context=block.key[0:1])
+
+ if block.key:
+ yield build_line(block.key, end=' {', indent=indent, context=block.key[0:1])
+ indent += 1
for item in block.items:
- yield build_item(item, indent=indent+1)
+ yield build_item(item, indent=indent)
for subblock in block.blocks:
- yield ''
+ if block.items:
+ yield ''
- for line in build_block(subblock, indent=indent+1):
+ for line in build_block(subblock, indent=indent):
yield line
-
- yield build_line((), end='}', indent=indent)
-
+
+ if block.key:
+ indent -= 1
+ yield build_line((), end='}', indent=indent)