pvl/dhcp/config.py
changeset 699 d34567c1b21a
parent 695 c60924eca185
child 707 13283078a929
--- 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):