From cbab1a5d1799e1bbf3cb0993c652056658ec0af1 Mon Sep 17 00:00:00 2001 From: elnappo Date: Fri, 5 Dec 2014 19:38:26 +0100 Subject: [PATCH] only show "(unkown)" in overview when hosts has this record, add some trans tags --- nsupdate/main/models.py | 4 ++-- nsupdate/main/templates/main/overview.html | 28 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/nsupdate/main/models.py b/nsupdate/main/models.py index ab795c8..73c32f4 100644 --- a/nsupdate/main/models.py +++ b/nsupdate/main/models.py @@ -277,9 +277,9 @@ class Host(models.Model): try: return dnstools.query_ns(self.get_fqdn(), record) except (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer): - return 'none' + return None except (dns.resolver.NoNameservers, dns.resolver.Timeout, dnstools.NameServerNotAvailable): - return 'error' + return _('error') def get_ipv4(self): return self.get_ip('ipv4') diff --git a/nsupdate/main/templates/main/overview.html b/nsupdate/main/templates/main/overview.html index 1026c50..faa2ebd 100644 --- a/nsupdate/main/templates/main/overview.html +++ b/nsupdate/main/templates/main/overview.html @@ -45,31 +45,31 @@ {{ host.available|yesno }} {{ host.client_faults }} / {{ host.server_faults }} {% if host.abuse_blocked %} -
Abuse-Blocked +
{% trans "Abuse-Blocked" %} {% elif host.abuse %} -
Abuse +
{% trans "Abuse" %} {% endif %} - {{ host.get_ipv4 }} + {{ host.get_ipv4|default_if_none:_("none")}}
- {% if host.last_update_ipv4 %} + {% if host.last_update_ipv4 and host.get_ipv4 %} ({{ host.last_update_ipv4|naturaltime }}, {% if not host.tls_update_ipv4 %} - no {% else %} - {% endif %}TLS) - {% else %} - (unknown) + {% trans "no" %} {% else %} + {% endif %}{% trans "TLS" %}) + {% elif host.get_ipv4 %} + ({% trans "unknown" %}) {% endif %} - {{ host.get_ipv6 }} + {{ host.get_ipv6|default_if_none:_("none") }}
- {% if host.last_update_ipv6 %} + {% if host.last_update_ipv6 and host.get_ipv6 %} ({{ host.last_update_ipv6|naturaltime }}, {% if not host.tls_update_ipv6 %} - no {% else %} - {% endif %}TLS) - {% else %} - (unknown) + {% trans "no" %} {% else %} + {% endif %}{% trans "TLS" %}) + {% elif host.get_ipv6 %} + ({% trans "unknown" %}) {% endif %}