diff --git a/geonode/base/models.py b/geonode/base/models.py
index c8a6c55aeb0..f4c721ea657 100644
--- a/geonode/base/models.py
+++ b/geonode/base/models.py
@@ -805,7 +805,7 @@ def csw_crs(self):
@property
def group_name(self):
if self.group:
- return str(self.group)
+ return str(self.group).encode("utf-8", "replace")
return None
@property
@@ -908,13 +908,13 @@ def metadata_completeness(self):
return '{}%'.format(len(filled_fields) * 100 / len(required_fields))
def keyword_list(self):
- return [kw.name for kw in self.keywords.all()]
+ return [kw.name.encode("utf-8", "replace") for kw in self.keywords.all()]
def keyword_slug_list(self):
- return [kw.slug for kw in self.keywords.all()]
+ return [kw.slug.encode("utf-8", "replace") for kw in self.keywords.all()]
def region_name_list(self):
- return [region.name for region in self.regions.all()]
+ return [region.name.encode("utf-8", "replace") for region in self.regions.all()]
def spatial_representation_type_string(self):
if hasattr(self.spatial_representation_type, 'identifier'):
diff --git a/geonode/base/templates/base/_resourcebase_snippet.html b/geonode/base/templates/base/_resourcebase_snippet.html
index 2ddf7e45b92..bfa66f7ca3f 100644
--- a/geonode/base/templates/base/_resourcebase_snippet.html
+++ b/geonode/base/templates/base/_resourcebase_snippet.html
@@ -53,9 +53,12 @@
{% trans "Service is" %} {% trans "offline" %}
{% verbatim %}
-
SECURITY NOT YET SYNCHRONIZED
- PENDING APPROVAL
- UNPUBLISHED
+ {% endverbatim %}
+ {% trans "SECURITY NOT YET SYNCHRONIZED" %}
+ {% trans "PENDING APPROVAL" %}
+ {% trans "UNPUBLISHED" %}
+ {% verbatim %}
+
{{ item.abstract | limitTo: 300 }}{{ item.abstract.length > 300 ? '...' : ''}}
diff --git a/geonode/geoserver/signals.py b/geonode/geoserver/signals.py
index e4297681b25..9db98eed857 100644
--- a/geonode/geoserver/signals.py
+++ b/geonode/geoserver/signals.py
@@ -243,14 +243,17 @@ def geoserver_post_save_local(instance, *args, **kwargs):
instance.workspace = gs_resource.store.workspace.name
instance.store = gs_resource.store.name
- bbox = gs_resource.native_bbox
-
- # Set bounding box values
- instance.bbox_x0 = bbox[0]
- instance.bbox_x1 = bbox[1]
- instance.bbox_y0 = bbox[2]
- instance.bbox_y1 = bbox[3]
- instance.srid = bbox[4]
+ try:
+ bbox = gs_resource.native_bbox
+
+ # Set bounding box values
+ instance.bbox_x0 = bbox[0]
+ instance.bbox_x1 = bbox[1]
+ instance.bbox_y0 = bbox[2]
+ instance.bbox_y1 = bbox[3]
+ instance.srid = bbox[4]
+ except BaseException:
+ pass
if instance.srid:
instance.srid_url = "http://www.spatialreference.org/ref/" + \
@@ -271,14 +274,17 @@ def geoserver_post_save_local(instance, *args, **kwargs):
gs_catalog.save(gs_resource)
if not settings.FREETEXT_KEYWORDS_READONLY:
- if len(instance.keyword_list()) == 0 and gs_resource.keywords:
- for keyword in gs_resource.keywords:
- if keyword not in instance.keyword_list():
- instance.keywords.add(keyword)
+ try:
+ if len(instance.keyword_list()) == 0 and gs_resource.keywords:
+ for keyword in gs_resource.keywords:
+ if keyword not in instance.keyword_list():
+ instance.keywords.add(keyword)
+ except BaseException:
+ pass
if any(instance.keyword_list()):
keywords = instance.keyword_list()
- gs_resource.keywords = list(set(keywords))
+ gs_resource.keywords = [kw.decode("utf-8", "replace") for kw in list(set(keywords))]
# gs_resource should only be called if
# ogc_server_settings.BACKEND_WRITE_ENABLED == True
@@ -321,7 +327,10 @@ def geoserver_post_save_local(instance, *args, **kwargs):
# store the resource to avoid another geoserver call in the post_save
instance.gs_resource = gs_resource
- bbox = gs_resource.native_bbox
+ try:
+ bbox = gs_resource.native_bbox
+ except BaseException:
+ bbox = instance.bbox
dx = float(bbox[1]) - float(bbox[0])
dy = float(bbox[3]) - float(bbox[2])
@@ -337,7 +346,10 @@ def geoserver_post_save_local(instance, *args, **kwargs):
instance.bbox_x1, instance.bbox_y1])
# Create Raw Data download link
- path = gs_resource.dom.findall('nativeName')
+ try:
+ path = gs_resource.dom.findall('nativeName')
+ except BaseException:
+ path = instance.alternate
download_url = urljoin(settings.SITEURL,
reverse('download', args=[instance.id]))
Link.objects.get_or_create(resource=instance.resourcebase_ptr,
@@ -397,7 +409,10 @@ def geoserver_post_save_local(instance, *args, **kwargs):
url=ogc_server_settings.public_url,
repo_name=geogig_repo_name)
- path = gs_resource.dom.findall('nativeName')
+ try:
+ path = gs_resource.dom.findall('nativeName')
+ except BaseException:
+ path = instance.alternate
if path:
path = 'path={path}'.format(path=path[0].text)
diff --git a/geonode/geoserver/upload.py b/geonode/geoserver/upload.py
index ed74216d1dc..cd926423ebe 100644
--- a/geonode/geoserver/upload.py
+++ b/geonode/geoserver/upload.py
@@ -180,8 +180,13 @@ def geoserver_upload(
# Step 6. Make sure our data always has a valid projection
# FIXME: Put this in gsconfig.py
logger.info('>>> Step 6. Making sure [%s] has a valid projection' % name)
- if gs_resource.native_bbox is None:
- box = gs_resource.native_bbox[:4]
+ _native_bbox = None
+ try:
+ _native_bbox = gs_resource.native_bbox
+ except BaseException:
+ pass
+ if _native_bbox:
+ box = _native_bbox[:4]
minx, maxx, miny, maxy = [float(a) for a in box]
if -180 <= minx <= 180 and -180 <= maxx <= 180 and \
- 90 <= miny <= 90 and -90 <= maxy <= 90:
@@ -190,7 +195,7 @@ def geoserver_upload(
# If GeoServer couldn't figure out the projection, we just
# assume it's lat/lon to avoid a bad GeoServer configuration
- gs_resource.latlon_bbox = gs_resource.native_bbox
+ gs_resource.latlon_bbox = _native_bbox
gs_resource.projection = "EPSG:4326"
cat.save(gs_resource)
else: