Skip to content

Commit

Permalink
Use getattr for tolerant accessing IGeoJSONProperties attributes. Als…
Browse files Browse the repository at this point in the history
…o use extraClasses for marker icons
  • Loading branch information
thet committed Apr 20, 2019
1 parent 1075781 commit 8c3d65b
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/collective/collectionfilter/baseviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,26 @@ def data_geojson(self):

props = IGeoJSONProperties(it.getObject())

features.append({
feature = {
'type': 'Feature',
'id': it.UID,
'properties': {
'popup': props.popup,
'color': props.color,
},
'properties': {},
'geometry': {
'type': 'Point',
'coordinates': [
it.longitude,
it.latitude,
]
}
})
}
if getattr(props, 'popup', None):
feature['properties']['popup'] = props.popup
if getattr(props, 'color', None):
feature['properties']['color'] = props.color
if getattr(props, 'extraClasses', None):
feature['properties']['extraClasses'] = props.extraClasses

features.append(feature)

if not features:
return
Expand Down

0 comments on commit 8c3d65b

Please sign in to comment.