Permalink
Browse files

Merge pull request #247 from drwelby/master

Fixes for errors when removing data layers
  • Loading branch information...
2 parents 6498ec5 + 2ac9d28 commit 80f58dc31b49afef7cb7f2342c933dc22466546c @ingenieroariel ingenieroariel committed Jun 8, 2012
@@ -1,4 +1,5 @@
from itertools import cycle, izip
+from geoserver.catalog import FailedRequestError
import logging
import re
from django.conf import settings
@@ -148,7 +149,13 @@ def cascading_delete(cat, resource):
cat.delete(lyr)
for s in styles:
if s is not None:
- cat.delete(s, purge=True)
+ try:
+ cat.delete(s, purge=True)
+ except FailedRequestError as e:
+ # Trying to delete a shared style will fail
+ # We'll catch the exception and log it.
+ logger.debug(e)
+
cat.delete(resource)
if store.resource_type == 'dataStore' and 'dbtype' in store.connection_parameters and store.connection_parameters['dbtype'] == 'postgis':
delete_from_postgis(resource_name)
@@ -750,7 +750,7 @@ def layer_remove(request, layername):
}))
if (request.method == 'POST'):
layer.delete()
- return HttpResponseRedirect(reverse("data"))
+ return HttpResponseRedirect(reverse("data_home"))
else:
return HttpResponse("Not allowed",status=403)
else:
@@ -7,7 +7,7 @@
<h3>{% trans "Are you sure you want to remove" %} <strong>{{layer.typename}}</strong>?</h3>
-<form action="{% url layer_remove layer.typename %}" method="POST">
+<form action="{% url data_remove layer.typename %}" method="POST">
{% csrf_token %}
<input type="hidden" value="{{layer.typename}}" />
<input type="submit" value="{% trans "Yes I am sure" %}" />

0 comments on commit 80f58dc

Please sign in to comment.