Skip to content

Commit

Permalink
[Backport 3.2.x] [Fixes #8641] Replace Layer (stable 3.2.x) (#8696)
Browse files Browse the repository at this point in the history
* - [Fixes #8641] Replace Layer (stable 3.2.x)

* Remove unused local variable

Co-authored-by: Alessio Fabiani <[email protected]>
  • Loading branch information
marthamareal and Alessio Fabiani authored Jan 27, 2022
1 parent 8ec2503 commit 10ba096
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion geonode/geoserver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,7 @@ def sync_instance_with_geoserver(
try:
# If the store in None then it's a new instance from an upload,
# only in this case run the geoserver_upload method
if getattr(instance, 'overwrite', False):
if kwargs.get('overwrite', False) or len(getattr(instance, 'store', '')) == 0:
base_file, info = instance.get_base_file()

# There is no need to process it if there is no file.
Expand Down
16 changes: 9 additions & 7 deletions geonode/layers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,15 @@ def file_upload(filename,
the_file = upload_session.layerfile_set.all()[0].file.name
assigned_name = os.path.splitext(os.path.basename(the_file))[0]

# Get a bounding box
*bbox, srid = get_bbox(filename)
bbox_polygon = BBOXHelper.from_xy(bbox).as_polygon()

if srid:
srid_url = f"http://www.spatialreference.org/ref/{srid.replace(':', '/').lower()}/" # noqa
bbox_polygon.srid = int(srid.split(':')[1])
# Getting a bounding box
if layer and layer.bbox_polygon:
bbox_polygon = layer.bbox_polygon
else:
*bbox, srid = get_bbox(filename)
bbox_polygon = BBOXHelper.from_xy(bbox).as_polygon()
if srid:
srid_url = f"http://www.spatialreference.org/ref/{srid.replace(':', '/').lower()}/" # noqa
bbox_polygon.srid = int(srid.split(':')[1])

# by default, if RESOURCE_PUBLISHING=True then layer.is_published
# must be set to False
Expand Down

0 comments on commit 10ba096

Please sign in to comment.