pvl/dns/zone.py
changeset 294 29720bbc5379
parent 292 cc4a4a2f2b76
child 295 8c6d4565576f
equal deleted inserted replaced
293:6351acf3eb3b 294:29720bbc5379
   297         log.debug("  ttl=%r, cls=%r, type=%r, data=%r", ttl, _cls, type, data)
   297         log.debug("  ttl=%r, cls=%r, type=%r, data=%r", ttl, _cls, type, data)
   298 
   298 
   299         return cls.build(line, name, ttl, _cls, type, data, **opts)
   299         return cls.build(line, name, ttl, _cls, type, data, **opts)
   300     
   300     
   301     @classmethod
   301     @classmethod
   302     def build (_cls, line, name, ttl, cls, type, data, **opts) :
   302     def build (cls, line, name, ttl, _cls, type, data, **opts) :
   303         return _cls(name, type, data,
   303         return cls(name, type, data,
   304             ttl     = ttl,
   304             ttl     = ttl,
   305             cls     = cls,
   305             cls     = _cls,
   306             line    = line,
   306             line    = line,
   307             **opts
   307             **opts
   308         )
   308         )
   309 
   309 
   310     @classmethod
   310     @classmethod
   328 
   328 
   329     @classmethod
   329     @classmethod
   330     def MX (cls, name, priority, mx, **opts) :
   330     def MX (cls, name, priority, mx, **opts) :
   331         return cls(str(name), 'MX', [int(priority), str(mx)], **opts)
   331         return cls(str(name), 'MX', [int(priority), str(mx)], **opts)
   332 
   332 
   333     def __init__ (self, name, type, data, origin=None, ttl=None, cls=None, line=None, comment=None) :
   333     def __init__ (self, name, type, data, ttl=None, cls=None, line=None, origin=None, comment=None) :
   334         self.name = name
   334         self.name = name
   335         self.type = type
   335         self.type = type
   336         self.data = data
   336         self.data = data
   337         
   337         
   338         self.ttl = ttl
   338         self.ttl = ttl
   339         self.cls = cls
   339         self.cls = cls
   340         
   340         
       
   341         self.line = line
   341         self.origin = origin
   342         self.origin = origin
   342         self.line = line
       
   343 
       
   344         self.comment = comment
   343         self.comment = comment
   345 
   344 
   346     def __unicode__ (self) :
   345     def __unicode__ (self) :
   347         """
   346         """
   348             Construct a zonefile-format line..."
   347             Construct a zonefile-format line..."
   367             self.name, self.type, self.data
   366             self.name, self.type, self.data
   368         )))
   367         )))
   369 
   368 
   370 class SOA (ZoneRecord) :
   369 class SOA (ZoneRecord) :
   371     @classmethod
   370     @classmethod
   372     def build (_cls, line, name, ttl, cls, type, data, **opts) :
   371     def build (cls, line, name, ttl, _cls, type, data, **opts) :
   373         assert name == '@'
   372         assert name == '@'
   374 
   373 
   375         return _cls(*data,
   374         return cls(*data,
   376             ttl     = ttl,
   375             ttl     = ttl,
   377             cls     = cls,
   376             cls     = cls,
   378             line    = line,
   377             line    = line,
   379             **opts
   378             **opts
   380         )
   379         )