From d2a6b38a2bd7fa5ad30a96484300998278db1eac Mon Sep 17 00:00:00 2001 From: Jeffrey Forman Date: Sat, 13 Oct 2012 17:00:22 -0400 Subject: [PATCH] template cleanup on adding records. use of tsig key is now optional --- binder/bcommon/forms.py | 2 +- binder/bcommon/helpers.py | 6 +++--- binder/templates/base.htm | 12 ++++++++++-- binder/templates/bcommon/add_record_form.htm | 6 +++++- binder/templates/bcommon/list_server_zones.htm | 13 +++++++------ binder/templates/bcommon/list_servers.htm | 6 +----- binder/templates/bcommon/list_zone.htm | 6 +++++- 7 files changed, 32 insertions(+), 19 deletions(-) diff --git a/binder/bcommon/forms.py b/binder/bcommon/forms.py index f280345..703e1eb 100644 --- a/binder/bcommon/forms.py +++ b/binder/bcommon/forms.py @@ -16,4 +16,4 @@ class FormAddRecord(forms.Form): ttl = forms.ChoiceField(choices=TTL_CHOICES, label="TTL", initial=86400) create_reverse = forms.BooleanField(label="Create Reverse Record (PTR)?", required=False) data = forms.CharField(max_length=256, label="Record Data (IP/Hostname)") - key_name = forms.ModelChoiceField(queryset=Key.objects.all(), empty_label=None, label="TSIG Key") + key_name = forms.ModelChoiceField(queryset=Key.objects.all(), empty_label=None, label="TSIG Key", required=False) diff --git a/binder/bcommon/helpers.py b/binder/bcommon/helpers.py index fc0e7c6..3e13a7c 100644 --- a/binder/bcommon/helpers.py +++ b/binder/bcommon/helpers.py @@ -74,10 +74,10 @@ def add_record(form_data): """Add a DNS record with data from a FormAddRecord object. If a reverse PTR record is requested, this will be added too.""" - try: + if form_data["key_name"]: keyring = create_keyring(form_data["key_name"]) - except Exception, err: - raise Exception("Error creating keyring in add_record: %s" % err) + else: + keyring = None response = {} forward_response = add_forward_record(form_data, keyring) diff --git a/binder/templates/base.htm b/binder/templates/base.htm index 474fc0f..172db0d 100644 --- a/binder/templates/base.htm +++ b/binder/templates/base.htm @@ -25,8 +25,16 @@ -{% block pageheader %} -{% endblock pageheader %} + + + {% block errors %} diff --git a/binder/templates/bcommon/add_record_form.htm b/binder/templates/bcommon/add_record_form.htm index 7a722b7..298a20c 100644 --- a/binder/templates/bcommon/add_record_form.htm +++ b/binder/templates/bcommon/add_record_form.htm @@ -1,8 +1,12 @@ {% extends "base.htm" %} +{% block pageheader %} +Add record in {{ dns_server }} +{% endblock pageheader %} + {% block body %}
{% csrf_token %} - +
{{ form.as_table }}
diff --git a/binder/templates/bcommon/list_server_zones.htm b/binder/templates/bcommon/list_server_zones.htm index 5721cb5..ec898cd 100644 --- a/binder/templates/bcommon/list_server_zones.htm +++ b/binder/templates/bcommon/list_server_zones.htm @@ -1,19 +1,20 @@ {% extends "base.htm" %} {% block pageheader %} - +Server Zone List for {{ dns_server }} {% endblock pageheader %} {% block body %} + + + + {% for current_zone in zone_array %} - + + {% endfor %}
ZoneSerial Number
{{ current_zone }} {{ current_zone.zone_name }}{{ current_zone.zone_serial }}
diff --git a/binder/templates/bcommon/list_servers.htm b/binder/templates/bcommon/list_servers.htm index d55c2db..0f0039f 100644 --- a/binder/templates/bcommon/list_servers.htm +++ b/binder/templates/bcommon/list_servers.htm @@ -2,11 +2,7 @@ {% block pageheader %} - +Server List {% endblock pageheader %} {% block body %} diff --git a/binder/templates/bcommon/list_zone.htm b/binder/templates/bcommon/list_zone.htm index 4a1a7f7..994a6ee 100644 --- a/binder/templates/bcommon/list_zone.htm +++ b/binder/templates/bcommon/list_zone.htm @@ -1,9 +1,13 @@ {% extends "base.htm" %} +{% block pageheader %} +Zone listing for {{ zone_name }} +{% endblock pageheader %} + {% block body %} {% if not errors %} - +
Name