diff -r 656178fb8607 -r d34567c1b21a pvl/dhcp/config.py --- a/pvl/dhcp/config.py Mon Mar 02 19:45:56 2015 +0200 +++ b/pvl/dhcp/config.py Mon Mar 02 19:58:12 2015 +0200 @@ -79,6 +79,18 @@ def __str__(self): return self.token +class String (Field): + """ + A quoted string + """ + + def __init__(self, string): + self.string = string + + def __str__(self): + # TODO: escape + return '"{self.string}"'.format(self=self) + def quote (value, context=None): """ Build a single field as part of a dhcp.conf line. @@ -103,6 +115,8 @@ 00:11:22:33:44:55 >>> print quote(Field('1:00:11:22:33:44:55')) 1:00:11:22:33:44:55 + >>> print quote(String('foobar')) + "foobar" """ if isinstance(value, Field):