Commits

Chris Miles committed 1dc742a

Added support for 'TXT' records.

__version__ = '1.2.0'

Comments (0)

Files changed (1)

easyzone/easyzone.py

 __copyright__ = '(c) Chris Miles 2007'
 __id__ = '$Id$'
 __url__ = '$URL$'
-__version__ = '1.1.2'
+__version__ = '1.2.0'
 
 
 # ---- Imports ----
 import dns.rdtypes.ANY.NS
 import dns.rdtypes.ANY.MX
 import dns.rdtypes.IN.A
+import dns.rdtypes.ANY.TXT
 
 
 # ---- Exceptions ----
             assert len(item) == 2
             assert type(item[0]) == types.IntType
             assert type(item[1]) == types.StringType
+        elif self.type == 'TXT':
+            assert type(item) == types.StringType
+            if item.startswith('"') and item.endswith('"'):
+                # strip quotes off both ends; dns module will add them automatically
+                item = item[1:-1]
         else:
             assert type(item) == types.StringType
         
 
 def _new_rdata(rectype, *args):
     '''Create a new rdata type of `rectype`.
-    rectype must be one of: 'NS', 'MX', 'A', 'CNAME'
+    rectype must be one of: 'NS', 'MX', 'A', 'CNAME', 'TXT'
     Extra arguments are as required by the rectype.
     '''
     if rectype == 'NS':
     elif rectype == 'CNAME':
         name = dns.name.Name( args[0].split('.') )
         rd = dns.rdtypes.ANY.CNAME.CNAME(dns.rdataclass.IN, dns.rdatatype.CNAME, name)
+    elif rectype == 'TXT':
+        name = dns.name.Name( args[0].split('.') )
+        rd = dns.rdtypes.ANY.TXT.TXT(dns.rdataclass.IN, dns.rdatatype.TXT, name)
     else:
         raise ValueError("rectype not supported: %s" %rectype)