Skip to content

Commit

Permalink
Merge pull request #492 from EOxServer/issue488
Browse files Browse the repository at this point in the history
`packageFormat` parameter should be optional
  • Loading branch information
constantinius authored Sep 17, 2021
2 parents 0e33d58 + 7201824 commit 43c5d47
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions eoxserver/services/ows/wcs/v20/geteocoverageset.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@

logger = logging.getLogger(__name__)

DEFAULT_DEFAULT_PACKAGE_FORMAT = 'application/gzip'

DEFAULT_PACKAGE_WRITERS = [
'eoxserver.services.ows.wcs.v20.packages.tar.TarPackageWriter',
Expand Down Expand Up @@ -174,7 +175,15 @@ def handle(self, request):
decoder = self.get_decoder(request)
eo_ids = decoder.eo_ids

package_format, format_params = decoder.package_format
package_format = decoder.package_format
if package_format:
package_format, format_params = package_format
else:
package_format = getattr(
settings, 'EOXS_DEFAULT_PACKAGE_FORMAT',
DEFAULT_DEFAULT_PACKAGE_FORMAT
)
format_params = {}
writer = self.get_pacakge_writer(package_format, format_params)

containment = decoder.containment
Expand Down Expand Up @@ -246,7 +255,7 @@ def handle(self, request):
product__collections__in=collections,
**filters
)
)
).distinct()

# Allow metadata queries on coverage itself or on the
# parent product if available
Expand Down Expand Up @@ -291,9 +300,7 @@ def handle(self, request):
Q( # Mosaics within directly referenced Collections
mosaic__collections__in=collections
)
).select_subclasses(models.Coverage, models.Mosaic)

all_coverages_qs = all_coverages_qs.order_by('identifier')
).distinct().select_subclasses(models.Coverage, models.Mosaic)

# limit coverages according to the number of dataset series
offset = decoder.start_index
Expand Down Expand Up @@ -396,7 +403,7 @@ class WCS20GetEOCoverageSetKVPDecoder(kvp.Decoder):
containment = kvp.Parameter(type=containment_enum, num="?")
count = kvp.Parameter(type=pos_int, num="?", default=MAXSIZE)
start_index = kvp.Parameter("startIndex", type=pos_int, num="?", default=0)
package_format = kvp.Parameter("packageFormat", num=1, type=parse_package_format)
package_format = kvp.Parameter("packageFormat", num="?", type=parse_package_format)
mediatype = kvp.Parameter("mediatype", num="?")
format = kvp.Parameter("format", num="?")
apply_subset = kvp.Parameter("applySubset", type=parse_apply_subset, default=True, num="?")
Expand All @@ -416,7 +423,7 @@ class WCS20GetEOCoverageSetXMLDecoder(xml.Decoder):
containment = xml.Parameter("wcseo11:containment/text()", type=containment_enum, locator="containment")
count = xml.Parameter("@count", type=pos_int, num="?", default=MAXSIZE, locator="count")
start_index = xml.Parameter("@startIndex", type=pos_int, num="?", default=0, locator="startIndex")
package_format = xml.Parameter("wcseo11:packageFormat/text()", type=parse_package_format, num=1, locator="packageFormat")
package_format = xml.Parameter("wcseo11:packageFormat/text()", type=parse_package_format, num="?", locator="packageFormat")
mediatype = xml.Parameter("wcs:mediaType/text()", num="?", locator="mediatype")
format = xml.Parameter("wcseo11:format/text()", num="?", locator="format")
apply_subset = xml.Parameter("wcseo11:applySubset/text()", type=parse_apply_subset, num="?", locator="format")
Expand Down

0 comments on commit 43c5d47

Please sign in to comment.