Commits

Chris Miles committed 953343f

Bugfix: values of TXT records were being mangled if they contained periods.

__version__ = '1.2.1'

  • Participants
  • Parent commits 205fd0c

Comments (0)

Files changed (2)

easyzone/easyzone.py

 __copyright__ = '(c) Chris Miles 2007'
 __id__ = '$Id$'
 __url__ = '$URL$'
-__version__ = '1.2.0'
+__version__ = '1.2.1'
 
 
 # ---- Imports ----
         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)
+        rd = dns.rdtypes.ANY.TXT.TXT(dns.rdataclass.IN, dns.rdatatype.TXT, args[0])
     else:
         raise ValueError("rectype not supported: %s" %rectype)
     

tests/easyzone_test.py

         self.failUnlessEqual(self.zone.names['foo.example.com.'].records('A'), None)
         self.failUnlessEqual(self.zone.names['foo.example.com.'].records('MX').items, [(10, 'mail.example.com.')])
     
+    def test_names_add_bar_TXT_simple(self):
+        # add simple TXT record to bar.example.com.
+        self.zone.names['bar.example.com.'].records('TXT', create=True).add('"v=spf1 a mx ?all"')
+        records = self.zone.names['bar.example.com.'].records('TXT').items
+        self.failUnlessEqual(records, ['"v=spf1 a mx ?all"'])
+    
+    def test_names_add_bar_TXT_with_periods(self):
+        # add TXT record to bar.example.com. containing periods
+        self.zone.names['bar.example.com.'].records('TXT', create=True).add('"v=spf1 a mx include:mailseat.com include:cluster3.eu.messagelabs.com ?all"')
+        records = self.zone.names['bar.example.com.'].records('TXT').items
+        self.failUnlessEqual(records, ['"v=spf1 a mx include:mailseat.com include:cluster3.eu.messagelabs.com ?all"'])
+    
+    def test_names_add_bar_TXT_no_quotes(self):
+        # add TXT record to bar.example.com. excluding surrounding quotes
+        self.zone.names['bar.example.com.'].records('TXT', create=True).add('v=spf1 a mx include:mailseat.com include:cluster3.eu.messagelabs.com ?all')
+        records = self.zone.names['bar.example.com.'].records('TXT').items
+        self.failUnlessEqual(records, ['"v=spf1 a mx include:mailseat.com include:cluster3.eu.messagelabs.com ?all"'])
+    
 
 
 class ZoneModifySaveTest(unittest.TestCase):