Skip to content

Commit

Permalink
Fixes: Errors on creating WMS Cascade stores and layers (references G…
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed May 24, 2022
1 parent d00cb53 commit a023ff5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/geoserver/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,17 @@ def _get_default_style(self, recursive=False):
return self._resolve_style(element, recursive) if element is not None else None

def _resolve_style(self, element, recursive=False):
if ":" in element.find('name').text:
ws_name, style_name = element.find('name').text.split(':')
else:
style_name = element.find('name').text
ws_name = None
atom_link = [n for n in element if 'href' in n.attrib]
if atom_link and ws_name is None:
ws_name = workspace_from_url(atom_link[0].get("href"))
return self.catalog.get_styles(names=style_name, workspaces=ws_name, recursive=recursive)[0]
if element and element.find('name') and element.find('name').text:
if ":" in element.find('name').text:
ws_name, style_name = element.find('name').text.split(':')
else:
style_name = element.find('name').text
ws_name = None
atom_link = [n for n in element if 'href' in n.attrib]
if atom_link and ws_name is None:
ws_name = workspace_from_url(atom_link[0].get("href"))
return self.catalog.get_styles(names=style_name, workspaces=ws_name, recursive=recursive)[0]
return None

def _set_default_style(self, style):
if isinstance(style, Style):
Expand Down

0 comments on commit a023ff5

Please sign in to comment.