Move pretty_ipv6_ptr setting retrieval out of record list loop

This commit is contained in:
Rauno Tuul 2023-02-13 14:43:22 +02:00
parent c5b9e24604
commit 642fb1605d

View File

@ -89,14 +89,14 @@ def domain(domain_name):
# - Find a way to make it consistent, or # - Find a way to make it consistent, or
# - Only allow one comment for that case # - Only allow one comment for that case
if StrictVersion(Setting().get('pdns_version')) >= StrictVersion('4.0.0'): if StrictVersion(Setting().get('pdns_version')) >= StrictVersion('4.0.0'):
pretty_v6 = Setting().get('pretty_ipv6_ptr')
for r in rrsets: for r in rrsets:
if r['type'] in records_allow_to_edit: if r['type'] in records_allow_to_edit:
r_name = r['name'].rstrip('.') r_name = r['name'].rstrip('.')
# If it is reverse zone and pretty_ipv6_ptr setting # If it is reverse zone and pretty_ipv6_ptr setting
# is enabled, we reformat the name for ipv6 records. # is enabled, we reformat the name for ipv6 records.
if Setting().get('pretty_ipv6_ptr') and r[ if pretty_v6 and r['type'] == 'PTR' and 'ip6.arpa' in r_name and '*' not in r_name:
'type'] == 'PTR' and 'ip6.arpa' in r_name and '*' not in r_name:
r_name = dns.reversename.to_address( r_name = dns.reversename.to_address(
dns.name.from_text(r_name)) dns.name.from_text(r_name))