pvl/dns/zone.py
changeset 298 fa1ab8cda47e
parent 297 63bce6f67916
child 300 a720bcf96007
equal deleted inserted replaced
297:63bce6f67916 298:fa1ab8cda47e
   621         # pack into nibbles
   621         # pack into nibbles
   622         nibbles = [((ord(x) >> 4) & 0xf, ord(x) & 0xf) for x in address.packed]
   622         nibbles = [((ord(x) >> 4) & 0xf, ord(x) & 0xf) for x in address.packed]
   623         nibbles = [nibble for nibblepair in nibbles for nibble in nibblepair]
   623         nibbles = [nibble for nibblepair in nibbles for nibble in nibblepair]
   624 
   624 
   625         # take the suffix
   625         # take the suffix
   626         nibbles = nibbles[:-(hostbits / 4)]
   626         nibbles = nibbles[-(hostbits / 4):]
   627         
   627         
   628         # reverse in hex
   628         # reverse in hex
   629         return '.'.join(reversed(["{0:x}".format(x) for x in nibbles]))
   629         return '.'.join(reversed(["{0:x}".format(x) for x in nibbles]))
   630 
   630 
   631     else :
   631     else :