diff --git a/binder/helpers.py b/binder/helpers.py index 95574b4..569f216 100644 --- a/binder/helpers.py +++ b/binder/helpers.py @@ -80,7 +80,7 @@ def add_cname_record(dns_server, zone_name, cname, originating_record, ttl, key_ return [{ "description" : "CNAME %s.%s points to %s" % (cname, zone_name, originating_record), "output" : output}] -def delete_record(dns_server, rr_list, key_name): +def delete_record(dns_server, zone_name, rr_list, key_name): """Delete a list of DNS records passed as strings in rr_items.""" try: @@ -92,17 +92,16 @@ def delete_record(dns_server, rr_list, key_name): keyring = transfer_key.create_keyring() algorithm = transfer_key.algorithm - delete_response = [] - for current_rr in rr_list: - record_list = current_rr.split(".") - record = record_list[0] - domain = ".".join(record_list[1:]) - dns_update = dns.update.Update(domain, keyring=keyring, keyalgorithm=algorithm) - dns_update.delete(record) - output = send_dns_update(dns_update, dns_server, key_name) + dns_update = dns.update.Update(zone_name, keyring=keyring, keyalgorithm=algorithm) + records = [] + for resource_record in rr_list: + dns_update.delete(resource_record) + records.append("%s.%s" % (zone_name, resource_record)) - delete_response.append({ "description" : "Delete Record: %s" % current_rr, - "output" : output }) + output = send_dns_update(dns_update, dns_server, key_name) + delete_response = [{"description": "Deleted Records:
%s" % + '
'.join(records), + "output": output}] return delete_response diff --git a/binder/templates/bcommon/list_zone.htm b/binder/templates/bcommon/list_zone.htm index 68f7cfb..5e08254 100644 --- a/binder/templates/bcommon/list_zone.htm +++ b/binder/templates/bcommon/list_zone.htm @@ -22,7 +22,7 @@ {% for current_record in zone_array %} - + {{ current_record.rr_name }} {{ current_record.rr_ttl }} {{ current_record.rr_class }} diff --git a/binder/templates/bcommon/response_result.htm b/binder/templates/bcommon/response_result.htm index e499ffb..3a84224 100644 --- a/binder/templates/bcommon/response_result.htm +++ b/binder/templates/bcommon/response_result.htm @@ -10,7 +10,7 @@ Output - {{ current_response.description }} + {{ current_response.description|safe }}
{{ current_response.output }}
{% endfor %} diff --git a/binder/views.py b/binder/views.py index 16c4281..6a6cb0a 100644 --- a/binder/views.py +++ b/binder/views.py @@ -204,6 +204,7 @@ def view_delete_result(request): print "in view_delete_result, form errors: %r" % form.errors delete_result = helpers.delete_record(clean_form["dns_server"], + clean_form["zone_name"], clean_form["rr_list"], clean_form["key_name"])