Skip to content

Commit

Permalink
cleanup old code
Browse files Browse the repository at this point in the history
  • Loading branch information
barrydaniels-nl committed Dec 3, 2024
1 parent 85fa1a0 commit 329cd9d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
6 changes: 5 additions & 1 deletion gisserver/output/geojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,11 @@ def render_feature(self, feature_type: FeatureType, instance: models.Model) -> b

# Filter by propertyName
if self.source_query.propertyName:
properties = {key: value for key, value in properties.items() if key in self.source_query.propertyName}
properties = {
key: value
for key, value in properties.items()
if key in self.source_query.propertyName
}

# Add the name field
if feature_type.show_name_field:
Expand Down
7 changes: 5 additions & 2 deletions gisserver/output/gml32.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def write_feature(
This output is typically wrapped in <wfs:member> tags
unless it's used for a GetPropertyById response.
"""

# Write <app:FeatureTypeName> start node
pk = _tag_escape(str(instance.pk))
self._write(f'<{feature_type.xml_name} gml:id="{feature_type.name}.{pk}"{extra_xmlns}>\n')
Expand All @@ -253,7 +253,10 @@ def write_feature(
# Separate call which can be optimized (no need to overload write_xml_field() for all calls).
self.write_gml_field(feature_type, xsd_element, instance)
else:
if self.source_query.propertyName and xsd_element.name not in self.source_query.propertyName:
if (
self.source_query.propertyName
and xsd_element.name not in self.source_query.propertyName
):
continue

value = xsd_element.get_value(instance)
Expand Down
8 changes: 2 additions & 6 deletions gisserver/queries/adhoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,12 @@ def get_type_names(self):

def compile_query(self, feature_type: FeatureType, using=None) -> fes20.CompiledQuery:
"""Return our internal CompiledQuery object that can be applied to the queryset."""
compiler = None

if self.filter:
# Generate the internal query object from the <fes:Filter>
compiler = self.filter.compile_query(feature_type, using=using)
return self.filter.compile_query(feature_type, using=using)
else:
# Generate the internal query object from the BBOX and sortBy args.
compiler = self._compile_non_filter_query(feature_type, using=using)

return compiler
return self._compile_non_filter_query(feature_type, using=using)

def _compile_non_filter_query(self, feature_type: FeatureType, using=None):
"""Generate the query based on the remaining parameters.
Expand Down

0 comments on commit 329cd9d

Please sign in to comment.