Skip to content

Commit

Permalink
[Fixes #3914] [Remote Services] Mitigate name clashes for service names
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Sep 13, 2018
1 parent 60e1933 commit bb6ead8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
5 changes: 2 additions & 3 deletions geonode/services/serviceprocessors/arcgis.py
Expand Up @@ -24,7 +24,6 @@
import traceback

from uuid import uuid4
from urlparse import urlsplit

from django.conf import settings
from django.template.defaultfilters import slugify, safe
Expand Down Expand Up @@ -87,7 +86,7 @@ def __init__(self, url):
# ])

self.indexing_method = INDEXED
self.name = slugify(urlsplit(self.url).netloc)[:40]
self.name = slugify(self.url)[:255]
self.title = _title

def create_cascaded_store(self):
Expand Down Expand Up @@ -328,5 +327,5 @@ def __init__(self, url):
# ])

self.indexing_method = INDEXED
self.name = slugify(urlsplit(self.url).netloc)[:40]
self.name = slugify(self.url)[:255]
self.title = _title
4 changes: 2 additions & 2 deletions geonode/services/serviceprocessors/wms.py
Expand Up @@ -118,7 +118,7 @@ def __init__(self, url):
INDEXED if self._offers_geonode_projection() else CASCADED)
# self.url = self.parsed_service.url
# TODO: Check if the name already esists
self.name = slugify(urlsplit(self.url).netloc)[:40]
self.name = slugify(self.url)[:255]

def create_cascaded_store(self):
store = self._get_store(create=True)
Expand Down Expand Up @@ -450,7 +450,7 @@ def __init__(self, url):
self.indexing_method = (
INDEXED if self._offers_geonode_projection() else CASCADED)
# self.url = self.parsed_service.url
self.name = slugify(urlsplit(self.url).netloc)[:40]
self.name = slugify(self.url)[:255]

def harvest_resource(self, resource_id, geonode_service):
"""Harvest a single resource from the service
Expand Down
2 changes: 1 addition & 1 deletion geonode/services/tests.py
Expand Up @@ -160,7 +160,7 @@ def test_has_valid_name_when_no_title_exists(self, mock_wms):
mock_wms.return_value[1].identification.title = ""
handler = wms.WmsServiceHandler(self.phony_url)
self.assertEqual(
handler.name, self.phony_url.replace("http://", "")[:40])
handler.name, slugify(self.phony_url)[:255])

@mock.patch("geonode.services.serviceprocessors.wms.WebMapService",
autospec=True)
Expand Down

0 comments on commit bb6ead8

Please sign in to comment.