Skip to content

Commit

Permalink
Backport fixes from master branch
Browse files Browse the repository at this point in the history
  • Loading branch information
afabiani committed Jul 20, 2018
1 parent 1f4215d commit 7e4454a
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ Clone the repository::
Launch the stack with the build of GeoNode so any changes you did will be immediately available::

docker-compose up --build

.. note::
**For Windows users**: In case you're using the native Docker for Windows (on Hyper-V) you will probably be affected by an error related to mounting the /var/run/docker.sock volume. It's due to a `problem with the current version of Docker Compose <https://github.com/docker/for-win/issues/1829>`_ for Windows.
In this case you need to set the **COMPOSE_CONVERT_WINDOWS_PATHS** environmental variable:

.. code-block:: none

set COMPOSE_CONVERT_WINDOWS_PATHS=1

before running docker-compose up

GeoNode will be available at the ip address of the ``docker0`` interface::

Expand Down
14 changes: 10 additions & 4 deletions geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from itertools import cycle, izip
import json
import logging
import traceback
import os
from os.path import basename, splitext, isfile
import re
Expand Down Expand Up @@ -240,24 +241,28 @@ def get_sld_for(gs_catalog, layer):
# GeoServer sometimes fails to associate a style with the data, so
# for now we default to using a point style.(it works for lines and
# polygons, hope this doesn't happen for rasters though)
gs_layer = None
_default_style = None
try:
_default_style = layer.default_style
except BaseException:
traceback.print_exc()
pass

if _default_style is None:
gs_catalog._cache.clear()
try:
gs_layer = gs_catalog.get_layer(layer.name)
name = gs_layer.default_style.name if gs_layer.default_style is not None else "raster"
except BaseException:
name = "raster"
traceback.print_exc()
name = None
else:
name = _default_style.name

# Detect geometry type if it is a FeatureType
if layer.resource and layer.resource.resource_type == 'featureType':
res = layer.resource
if gs_layer and gs_layer.resource and gs_layer.resource.resource_type == 'featureType':
res = gs_layer.resource
res.fetch()
ft = res.store.get_resources(res.name)
ft.fetch()
Expand Down Expand Up @@ -434,7 +439,8 @@ def cascading_delete(cat, layer_name):
try:
logger.info("Trying to delete Style [%s]" % s.name)
cat.delete(s, purge='true')
workspace, name = layer_name.split(':')
workspace, name = layer_name.split(':') if ':' in layer_name else \
(settings.DEFAULT_WORKSPACE, layer_name)
except FailedRequestError as e:
# Trying to delete a shared style will fail
# We'll catch the exception and log it.
Expand Down
9 changes: 6 additions & 3 deletions geonode/geoserver/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,8 @@ def command_url(command):
)
)

ogc_wms_path = '%s/ows' % instance.workspace
# ogc_wms_path = '%s/ows' % instance.workspace
ogc_wms_path = 'ows'
ogc_wms_url = urljoin(ogc_server_settings.public_url, ogc_wms_path)
ogc_wms_name = 'OGC WMS: %s Service' % instance.workspace
Link.objects.get_or_create(resource=instance.resourcebase_ptr,
Expand All @@ -528,7 +529,8 @@ def command_url(command):
)

if instance.storeType == "dataStore":
ogc_wfs_path = '%s/wfs' % instance.workspace
# ogc_wfs_path = '%s/wfs' % instance.workspace
ogc_wfs_path = 'wfs'
ogc_wfs_url = urljoin(ogc_server_settings.public_url, ogc_wfs_path)
ogc_wfs_name = 'OGC WFS: %s Service' % instance.workspace
Link.objects.get_or_create(resource=instance.resourcebase_ptr,
Expand All @@ -543,7 +545,8 @@ def command_url(command):
)

if instance.storeType == "coverageStore":
ogc_wcs_path = '%s/wcs' % instance.workspace
# ogc_wcs_path = '%s/wcs' % instance.workspace
ogc_wcs_path = 'wcs'
ogc_wcs_url = urljoin(ogc_server_settings.public_url, ogc_wcs_path)
ogc_wcs_name = 'OGC WCS: %s Service' % instance.workspace
Link.objects.get_or_create(resource=instance.resourcebase_ptr,
Expand Down
2 changes: 1 addition & 1 deletion geonode/local_settings.py.geoserver.sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ HOSTNAME = _surl.hostname
if not SITEURL.endswith('/'):
SITEURL = '{}/'.format(SITEURL)

ALLOWED_HOSTS = ['localhost', 'geonode.example.com']
ALLOWED_HOSTS = [HOSTNAME, 'localhost']

# TIME_ZONE = 'Europe/Paris'

Expand Down
8 changes: 4 additions & 4 deletions geonode/tests/csw.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def test_csw_outputschema_dc(self):
if link['scheme'] == 'OGC:WMS':
self.assertEqual(
link['url'],
'http://localhost:8080/geoserver/geonode/ows',
'http://localhost:8080/geoserver/ows',
'Expected a specific OGC:WMS URL')
elif link['scheme'] == 'OGC:WFS':
self.assertEqual(
link['url'],
'http://localhost:8080/geoserver/geonode/wfs',
'http://localhost:8080/geoserver/wfs',
'Expected a specific OGC:WFS URL')
elif check_ogc_backend(qgis_server.BACKEND_PACKAGE):
if link['scheme'] == 'OGC:WMS':
Expand Down Expand Up @@ -197,12 +197,12 @@ def test_csw_outputschema_iso(self):
if link.protocol == 'OGC:WMS':
self.assertEqual(
link.url,
'http://localhost:8080/geoserver/geonode/ows',
'http://localhost:8080/geoserver/ows',
'Expected a specific OGC:WMS URL')
elif link.protocol == 'OGC:WFS':
self.assertEqual(
link.url,
'http://localhost:8080/geoserver/geonode/wfs',
'http://localhost:8080/geoserver/wfs',
'Expected a specific OGC:WFS URL')
if check_ogc_backend(qgis_server.BACKEND_PACKAGE):
if link.protocol == 'OGC:WMS':
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ geonode-announcements==1.0.13 # python-geonode-announcements (1.0.13 in our ppa)
geonode-agon-ratings==0.3.8 # python-geonode-agon-ratings (0.3.8 in our ppa)
arcrest>=10.0 # TODO
geonode-dialogos==0.9 # python-geonode-dialogos (0.9 in our ppa)
gsconfig<2.0.0 # python-gsconfig (1.0.8 in our ppa)
gn-gsimporter>=1.0.3,<2.0.0 # python-gn-gsimporter (1.0.2 in our ppa)
gsconfig>=1.0.10 # python-gsconfig (1.0.8 in our ppa)
gn-gsimporter>=1.0.8 # python-gn-gsimporter (1.0.2 in our ppa)
gisdata==0.5.4 # python-gisdata (0.5.4 in our ppa)

# haystack/elasticsearch, uncomment to use
Expand Down
4 changes: 2 additions & 2 deletions requirements_docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ geonode-dialogos==0.9
geonode-user-messages==0.1.14
gisdata==0.5.4
glob2==0.6
gn-gsimporter>=1.0.3
gsconfig==1.0.8
gn-gsimporter>=1.0.6
gsconfig>=1.0.10
httplib2==0.10.3
idna==2.6
inflection==0.3.1
Expand Down

0 comments on commit 7e4454a

Please sign in to comment.