Skip to content

Commit

Permalink
fix STAC API item deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
tomkralidis committed Jan 8, 2025
1 parent c0a137e commit 5fd6912
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions pycsw/stac/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ def collections(self, headers_, args):
virtual_collections = self.repository.query_collections(filters, limit)

for virtual_collection in virtual_collections:
print("VIRTUAL COLLECTION", virtual_collection)
virtual_collection_info = self.get_collection_info(
virtual_collection.identifier, virtual_collection)

Expand Down Expand Up @@ -524,8 +523,8 @@ def get_collection_info(self, collection_name: str = 'metadata:main',
}

def manage_collection_item(self, headers_, action='create', item=None, data=None, collection=None):
if action == 'create' and 'features' in data:
LOGGER.debug('STAC Collection detected')
if action == 'create' and data is not None and 'features' in data:
LOGGER.debug('STAC ItemCollection detected')

for feature in data['features']:
data2 = feature
Expand All @@ -538,11 +537,12 @@ def manage_collection_item(self, headers_, action='create', item=None, data=None
return self.get_response(201, headers_, {})

else: # default/super
LOGGER.debug('STAC Collection detected')
if collection is not None:
data['collection'] = collection

return super().manage_collection_item(
headers_=headers_, action=action, item=item, data=data)
headers_=headers_, action=action, item=data['id'], data=data)


def links2stacassets(collection, record):
Expand Down
3 changes: 2 additions & 1 deletion pycsw/wsgi_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ def items(collection='metadata:main'):

@BLUEPRINT.route('/collections/<collection>/items/<path:item>',
methods=['GET', 'PUT', 'DELETE'])
@BLUEPRINT.route('/stac/collections/<collection>/items/<item>')
@BLUEPRINT.route('/stac/collections/<collection>/items/<item>',
methods=['GET', 'PUT', 'DELETE'])
def item(collection='metadata:main', item=None):
"""
OGC API collection items endpoint
Expand Down

0 comments on commit 5fd6912

Please sign in to comment.