Skip to content

Commit

Permalink
[Fixes #4884] Attached SLD works only with ZIP files when "geonode.im…
Browse files Browse the repository at this point in the history
…porter" method is enabled

 - Test cases
  • Loading branch information
afabiani committed Sep 13, 2019
1 parent c89da0a commit 7d1a6a1
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion geonode/layers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def get_files(filename):
if not os.path.exists(filename):
msg = ('Could not open %s. Make sure you are using a '
'valid file' % filename)
logger.warn(msg)
logger.debug(msg)
raise GeoNodeException(msg)

base_name, extension = os.path.splitext(filename)
Expand Down
12 changes: 12 additions & 0 deletions geonode/upload/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,18 @@ def test_scan_file(self):
path = os.path.join(basedir, '_%s' % f)
self.assertTrue(os.path.exists(path))

# Test the scan_file function with a raster spatial file takes SLD also.
file_names = ['109029_24.tif', '109029_24.sld']
with create_files(file_names) as tests:
spatial_files = scan_file(tests[0])
self.assertTrue(isinstance(spatial_files, SpatialFiles))

spatial_file = spatial_files[0]
self.assertTrue(spatial_file.file_type.matches('tif'))
self.assertEqual(len(spatial_file.auxillary_files), 0)
self.assertEqual(len(spatial_file.xml_files), 0)
self.assertEqual(len(spatial_file.sld_files), 1)


class TimeFormFormTest(GeoNodeBaseTestSupport):

Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/tests/test_upload_preprocessing.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def test_preprocess_files_kml_ground_overlay(self, mock_handler):
image_path = "another_fake_path.png"
data = [
files.SpatialFile(
base_file="fake_path.kml",
base_file=kml_path,
file_type=files.get_type("KML Ground Overlay"),
auxillary_files=[image_path],
sld_files=[],
Expand Down
2 changes: 1 addition & 1 deletion geonode/upload/upload_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def dupes(_a):
if not allow_multiple or (
'properties' not in other_extensions and (
'sld' in other_extensions or 'xml' in other_extensions)):
return valid_extensions
return valid_extensions + other_extensions
else:
return ("zip-mosaic",)
else:
Expand Down
2 changes: 1 addition & 1 deletion geonode/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ def fixup_shp_columnnames(inShapefile, charset, tempdir=None):
logger.debug(tb)
inDataSource = None
if inDataSource is None:
logger.warning('Could not open %s' % (inShapefile))
logger.debug('Could not open %s' % (inShapefile))
return False, None, None
else:
inLayer = inDataSource.GetLayer()
Expand Down

0 comments on commit 7d1a6a1

Please sign in to comment.