-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Layergroup creation bugfix #97
Layergroup creation bugfix #97
Conversation
That's the correct status code for non-existing layergroups. I think it is not necessary to bypass the |
I agree, |
if self.get_layergroup(name) is not None: | ||
raise Exception( | ||
f"Layergroup: {name} already exist in Geoserver instance" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether it is smart to remove the check entirely, because this will cause issues for any code that assumes it will get an error if the layergroup exists already.
I would suggest to check for an exception in get_layergroup, like (I don't know if this is the most pythonic solution, but it works):
# check if it already exist in Geoserver
try:
existing_layer_group = self.get_layergroup(name)
except:
existing_layer_group = None
if existing_layer_group is not None:
raise Exception(
f"Layergroup: {name} already exists in Geoserver instance"
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it is the correct way of fixing for now. Can you please update this PR with above suggestion? @julescarpentier
Hi,
Geoserver now returns 404 HTTP error code when requesting for a resource that doesn't exists (instead of 200 OK with empty JSON before I imagine)
This impacts the layergroup creation method as it checks a layergroup with the same name doesn't exists already.
Best regards