diff --git a/binder/bcommon/models.py b/binder/bcommon/models.py index 4c0f781..800f789 100644 --- a/binder/bcommon/models.py +++ b/binder/bcommon/models.py @@ -24,7 +24,7 @@ class BindServer(models.Model): try: http_request = urllib2.urlopen(myreq) except urllib2.URLError, err_reason: # Error retrieving zone list. - return { 'errors' : err_reason, 'error_context' : "Trying to retrieve zone list from %s" % self.hostname } + return { 'errors' : "Trying to retrieve zone list from %s: %s" % (self.hostname, err_reason) } return_array = [] xmloutput = http_request.read() diff --git a/binder/bcommon/views.py b/binder/bcommon/views.py index 1166af1..0347a1c 100644 --- a/binder/bcommon/views.py +++ b/binder/bcommon/views.py @@ -25,23 +25,21 @@ def view_server_list(request): def view_server_zones(request, dns_server): """ Display the list of DNS zones a particular DNS host provides. """ + errors = "" + zone_array = {} try: this_server = BindServer.objects.get(hostname=dns_server) zone_array = this_server.list_zones() except BindServer.DoesNotExist, err: - return render_to_response('bcommon/list_server_zones.htm', - { 'errors' : "The server %s does not exist in this Binder instance." % dns_server }, - context_instance=RequestContext(request)) + errors = err - if 'errors' in zone_array: - return render_to_response('bcommon/list_server_zones.htm', - { 'errors' : zone_array['errors'], - 'error_context' : zone_array['error_context'] }) + if "errors" in zone_array: + errors = zone_array["errors"] return render_to_response('bcommon/list_server_zones.htm', - { 'zone_array' : zone_array, - 'dns_server' : dns_server }, - context_instance=RequestContext(request)) + { "errors" : errors, + "dns_server" : dns_server, + "zone_array" : zone_array}) def view_zone_records(request, dns_server, zone_name): """ Display the list of records for a a particular zone.""" diff --git a/binder/templates/base.htm b/binder/templates/base.htm index 58ad465..91f9c1c 100644 --- a/binder/templates/base.htm +++ b/binder/templates/base.htm @@ -34,18 +34,13 @@ {% block errors %} - {% if errors %}
Errors were encountered:
{{ errors }} - {% if error_context %} - {{ error_context }} - {% endif %}
{% endif %} - {% endblock errors %} {% block body %}