Commit d6aed32e authored by Andrey Vertiprahov's avatar Andrey Vertiprahov
Browse files

Merge branch 'backport-5648' into 'release-20.4'

release-20.4:Backport!5648

See merge request !5763
parents 236d7701 433cefa1
# ----------------------------------------------------------------------
# RR helper class
# ----------------------------------------------------------------------
# Copyright (C) 2007-2020 The NOC Project
# Copyright (C) 2007-2021 The NOC Project
# See LICENSE for details
# ----------------------------------------------------------------------
# python modules
import string
# NOC modules
from .encoding import to_idna
......@@ -96,4 +99,9 @@ class RR(object):
try:
return int(v)
except ValueError:
return v
return int(v, base=16) if RR.is_hex(v) else v
@staticmethod
def is_hex(s):
hex_digits = set(string.hexdigits)
return all(c in hex_digits for c in s)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment