@param rdclass: The zone's rdata class; the default is class IN.
@type rdclass: int"""
- if isinstance(origin, string_types):
- origin = dns.name.from_text(origin)
- elif not isinstance(origin, dns.name.Name):
- raise ValueError("origin parameter must be convertable to a "
- "DNS name")
- if not origin.is_absolute():
- raise ValueError("origin parameter must be an absolute name")
+ if origin is not None:
+ if isinstance(origin, string_types):
+ origin = dns.name.from_text(origin)
+ elif not isinstance(origin, dns.name.Name):
+ raise ValueError("origin parameter must be convertable to a "
+ "DNS name")
+ if not origin.is_absolute():
+ raise ValueError("origin parameter must be an absolute name")
self.origin = origin
self.rdclass = rdclass
self.nodes = {}
z = dns.zone.Zone(1.0)
self.failUnlessRaises(ValueError, bad2)
+ def testZoneOriginNone(self):
+ z = dns.zone.Zone(None)
+
if __name__ == '__main__':
unittest.main()