Skip to content

Commit

Permalink
[Fixes #257] Add RemoteResourceHandler
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiagiupponi committed Jul 23, 2024
1 parent e481c03 commit 8029b1b
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion importer/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def create(self, request, *args, **kwargs):
handler = orchestrator.get_handler(_data)

# not file but handler means that is a remote resource
if (_file and handler) or (not _file and handler):
if handler:
asset = None
files = []
try:
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def can_handle_sld_file(self) -> bool:
return True

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps
"""
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/common/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def get_geoserver_store_name(default=None):
return default, False

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps
"""
Expand Down
4 changes: 2 additions & 2 deletions importer/handlers/common/remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def can_handle(_data) -> bool:
return True

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
We mark it as valid if the urls is reachable
and if the url is valid
Expand Down Expand Up @@ -195,7 +195,7 @@ def create_link(self, resource, params: dict, name):
resource=resource,
extension=params.get("type"),
url=params.get("url"),
link_type="remote",
link_type="data",
name=name,
)
link.save()
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/common/vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def get_geoserver_store_name(default=None):
return os.environ.get("GEONODE_GEODATABASE", "geonode_data"), True

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps
"""
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/csv/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def can_handle(_data) -> bool:
)

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
BaseVectorFileHandler.is_valid(files, user)
# getting the upload limit validation
upload_validator = UploadLimitValidator(user)
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/geojson/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def can_handle(_data) -> bool:
return False

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps:
"""
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/geotiff/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def can_handle(_data) -> bool:
return ext in ["tiff", "geotiff", "tif", "geotif"]

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps:
"""
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/gpkg/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def can_handle(_data) -> bool:
)

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps:
Upload limit:
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/kml/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def can_handle(_data) -> bool:
)

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps:
Upload limit:
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/shapefile/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def extract_params_from_data(_data, action=None):
return additional_params, _data

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps:
"""
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/sld/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def can_handle(_data) -> bool:
)

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps
"""
Expand Down
2 changes: 1 addition & 1 deletion importer/handlers/tiles3d/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def can_handle(_data) -> bool:
return False

@staticmethod
def is_valid(files, user, _execid=None):
def is_valid(files, user):
"""
Define basic validation steps:
"""
Expand Down
4 changes: 2 additions & 2 deletions importer/handlers/tiles3d/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ def test_set_bbox_from_bounding_volume_sphere_with_transform(self):

self.assertEqual(resource.bbox_x0, -75.61213927392595)
self.assertEqual(resource.bbox_x1, -75.61204934172301)
self.assertEqual(resource.bbox_y0, 40.042485645323616)
self.assertEqual(resource.bbox_y1, 40.042575577526556)
self.assertEqual(resource.bbox_y0, 40.04248564532361)
self.assertEqual(resource.bbox_y1, 40.04257557752655)

os.remove("/tmp/tileset.json")

Expand Down
2 changes: 1 addition & 1 deletion runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ set -a
. ./.env_test
set +a

coverage run --source='.' --omit="*/test*" /usr/src/geonode/manage.py test importer -v2 --noinput
coverage run --source='.' --omit="*/test*" /usr/src/geonode/manage.py test importer.tests -v2 --noinput --keepdb

0 comments on commit 8029b1b

Please sign in to comment.