pvl/dhcp/config.py
changeset 685 668f934bb958
parent 682 60dbd952a15e
child 695 c60924eca185
equal deleted inserted replaced
684:fbac5a08c9d3 685:668f934bb958
   311         }
   311         }
   312     """
   312     """
   313 
   313 
   314     if block.comment:
   314     if block.comment:
   315         yield build_line((), end="# {comment}".format(comment=block.comment), indent=indent)
   315         yield build_line((), end="# {comment}".format(comment=block.comment), indent=indent)
   316 
   316     
   317     yield build_line(block.key, end=' {', indent=indent, context=block.key[0:1])
   317     if block.key:
       
   318         yield build_line(block.key, end=' {', indent=indent, context=block.key[0:1])
       
   319         indent += 1
   318     
   320     
   319     for item in block.items:
   321     for item in block.items:
   320         yield build_item(item, indent=indent+1)
   322         yield build_item(item, indent=indent)
   321 
   323 
   322     for subblock in block.blocks:
   324     for subblock in block.blocks:
   323         yield ''
   325         if block.items:
   324 
   326             yield ''
   325         for line in build_block(subblock, indent=indent+1):
   327 
       
   328         for line in build_block(subblock, indent=indent):
   326             yield line
   329             yield line
   327 
   330     
   328     yield build_line((), end='}', indent=indent)
   331     if block.key:
   329 
   332         indent -= 1
       
   333         yield build_line((), end='}', indent=indent)