George Notaras  committed 898aa80

Improved error handling when zone exists.

  • Participants
  • Parent commits 2ad7cb0
  • Branches default

Comments (0)

Files changed (1)

File src/powerdns_manager/

 from django.utils.translation import ugettext_lazy as _
 from django.http import HttpResponse
 from django.db.models.loading import cache
+from django.utils.html import mark_safe
 from powerdns_manager.forms import ZoneImportForm
 from powerdns_manager.utils import process_zone_file
                     # If ``overwrite`` has been checked, then delete the current zone.
-                    return HttpResponse('<h1>Error</h1><p>Zone already exists</p>', content_type="text/html")
+                    info_dict = {
+                        'strerror': mark_safe('Zone already exists. If you wish to replace it with the imported one, check the <em>Overwrite</em> option in the import form.'),
+                    }
+                    return render_to_response('powerdns_manager/import/error.html', info_dict, mimetype='text/html')
                 process_zone_file(origin, zonetext)