def Go(self): if self.RecordName: ttl, rds=self._getRds() vlist=[] for rd in self.rds: value=eval("rd.%s" % rd.__slots__[0]) if isinstance(value, list): value=" ".join(map(quoteIfNeeded, value)) vlist.append(str(value)) self.value="\n".join(vlist) else: ttl=86400 rds=Rdataset(ttl, rdataclass.IN, self.rdtype) self.rds=None typestr=rdatatype.to_text(self.rdtype) self.SetTitle(DnsSupportedTypes[typestr]) self.RecordNameStatic = typestr self.ValueStatic=rds[0].__slots__[0].capitalize() self.dataclass=type(eval("rds[0].%s" % rds[0].__slots__[0])) if self.dataclass == int: validatorClass=Validator.Get("uint") if validatorClass: self['Value'].validator=validatorClass(self['Value'], "uint") elif self.dataclass == Name: self.dataclass = DnsName self.TTL=floatToTime(ttl, -1)
def Display(self, node, _detached): if not node or node != self.lastNode: self.storeLastItem() if not self.prepare(node): return node=self.lastNode self.control.AddColumn(xlt("Name"), 10) self.control.AddColumn(xlt("Type"), 5) self.control.AddColumn(xlt("Values"), 40) self.control.AddColumn(xlt("TTL"), 5) self.RestoreListcols() for other in sorted(node.others.keys()): rdss=node.others[other] for rds in rdss.values(): icon=node.GetImageId('other') dnstype=rdatatype.to_text(rds.rdtype) name=other for rd in rds: values=[] for slot in rd.__slots__: value=eval("rd.%s" % slot) if isinstance(value, list): if len(value) > 1: logger.debug("Value list dimensions > 1: %s", str(value)) value=" ".join(value) values.append("%s=%s" % (slot, value)) self.control.AppendItem(icon, [name, dnstype, ", ".join(values), floatToTime(rds.ttl, -1)]) icon=0 name="" dnstype="" self.restoreLastItem()
def Go(self): if self.RecordName: ttl, rds = self._getRds() self.changed = False else: ttl = 86400 self.rds = None self.changed = True cls = RdataClass(rdataclass.IN, self.rdtype) rds = Rdataset(ttl, rdataclass.IN, self.rdtype) typestr = rdatatype.to_text(self.rdtype) self.SetTitle(DnsSupportedTypes[typestr]) self.RecordNameStatic = typestr self.slots = rds[0].__slots__ self.slotvals = [] for slot in self.slots: self.slotvals.append(eval("rds[0].%s" % slot)) self.grid.CreateGrid(1, len(self.slots)) self.grid.SetRowLabelSize(0) for col in range(len(self.slots)): self.grid.SetColLabelValue(col, self.slots[col].capitalize()) self.grid.AutoSizeColLabelSize(col) colsize = self.grid.GetColSize(col) if isinstance(self.slotvals[col], int): minwidth, _h = self.grid.GetTextExtent("99999") self.grid.SetColFormatNumber(col) else: minwidth, _h = self.grid.GetTextExtent( "TheSampleTarget.admin.org") MARGIN = 8 minwidth += MARGIN if colsize < minwidth: self.grid.SetColSize(col, minwidth) if self.RecordName: row = 0 for _rd in self.rds: for col in range(len(self.slots)): val = eval("_rd.%s" % self.slots[col]) if isinstance(val, list): val = " ".join(val) self.grid.SetCellValue(row, col, str(val)) self.grid.AppendRows(1) row += 1 self.TTL = floatToTime(ttl, -1) self.Show() self.grid.AutoSizeColumns() maxwidth, _h = self.grid.GetSize() width = 0 cn = self.grid.GetNumberCols() - 1 for col in range(cn + 1): width += self.grid.GetColSize(col) if width < maxwidth: self.grid.SetColSize(cn, self.grid.GetColSize(cn) + maxwidth - width)
def Go(self): if self.RecordName: ttl, rds = self._getRds() vlist = [] for rd in self.rds: value = eval("rd.%s" % rd.__slots__[0]) if isinstance(value, list): value = " ".join(map(quoteIfNeeded, value)) vlist.append(str(value)) self.value = "\n".join(vlist) else: ttl = 86400 rds = Rdataset(ttl, rdataclass.IN, self.rdtype) self.rds = None typestr = rdatatype.to_text(self.rdtype) self.SetTitle(DnsSupportedTypes[typestr]) self.RecordNameStatic = typestr self.ValueStatic = rds[0].__slots__[0].capitalize() self.dataclass = type(eval("rds[0].%s" % rds[0].__slots__[0])) if self.dataclass == int: validatorClass = Validator.Get("uint") if validatorClass: self['Value'].validator = validatorClass(self['Value'], "uint") elif self.dataclass == Name: self.dataclass = DnsName self.TTL = floatToTime(ttl, -1)
def Go(self): if self.RecordName: ttl, rds=self._getRds() self.changed=False else: ttl=86400 self.rds=None self.changed=True cls=RdataClass(rdataclass.IN, self.rdtype) rds=Rdataset(ttl, rdataclass.IN, self.rdtype) typestr=rdatatype.to_text(self.rdtype) self.SetTitle(DnsSupportedTypes[typestr]) self.RecordNameStatic = typestr self.slots=rds[0].__slots__ self.slotvals=[] for slot in self.slots: self.slotvals.append(eval("rds[0].%s" % slot)) self.grid.CreateGrid(1, len(self.slots)) self.grid.SetRowLabelSize(0) for col in range(len(self.slots)): self.grid.SetColLabelValue(col, self.slots[col].capitalize()) self.grid.AutoSizeColLabelSize(col) colsize=self.grid.GetColSize(col) if isinstance(self.slotvals[col], int): minwidth, _h=self.grid.GetTextExtent("99999") self.grid.SetColFormatNumber(col) else: minwidth, _h=self.grid.GetTextExtent("TheSampleTarget.admin.org") MARGIN=8 minwidth += MARGIN if colsize < minwidth: self.grid.SetColSize(col, minwidth) if self.RecordName: row=0 for _rd in self.rds: for col in range(len(self.slots)): val=eval("_rd.%s" % self.slots[col]) if isinstance(val, list): val=" ".join(val) self.grid.SetCellValue(row, col, str(val)) self.grid.AppendRows(1) row += 1 self.TTL=floatToTime(ttl, -1) self.Show() self.grid.AutoSizeColumns() maxwidth, _h=self.grid.GetSize() width=0 cn=self.grid.GetNumberCols()-1 for col in range(cn+1): width += self.grid.GetColSize(col) if width < maxwidth: self.grid.SetColSize(cn, self.grid.GetColSize(cn) + maxwidth-width)
def Display(self, node, _detached): if not node or node != self.lastNode: self.storeLastItem() if not self.prepare(node): return node = self.lastNode self.control.AddColumn(xlt("Name"), 10) self.control.AddColumn(xlt("Type"), 5) self.control.AddColumn(xlt("Values"), 40) self.control.AddColumn(xlt("TTL"), 5) self.RestoreListcols() for other in sorted(node.others.keys()): rdss = node.others[other] for rds in rdss.values(): icon = node.GetImageId('other') dnstype = rdatatype.to_text(rds.rdtype) name = other for rd in rds: values = [] for slot in rd.__slots__: value = eval("rd.%s" % slot) if isinstance(value, list): if len(value) > 1: logger.debug( "Value list dimensions > 1: %s", str(value)) value = " ".join(value) values.append("%s=%s" % (slot, value)) self.control.AppendItem(icon, [ name, dnstype, ", ".join(values), floatToTime(rds.ttl, -1) ]) icon = 0 name = "" dnstype = "" self.restoreLastItem()