Skip to content

Commit

Permalink
Merge pull request #1118 from noirbizarre/geojson-2.x-upgrade
Browse files Browse the repository at this point in the history
Pin GeoJSON version to latest and fix breaking changes
  • Loading branch information
noirbizarre committed Sep 11, 2017
2 parents 7c75eda + ad564de commit eea823b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,7 @@
[#1114](https://github.com/opendatateam/udata/pull/1114)
- Raise the minimum `raven` version to ensure sentry is filtering legit HTTP exceptions
[#774](https://github.com/opendatateam/udata/issues/774)
- Pin GeoJSON version to avoid breaking changes

## 1.1.4 (2017-09-05)

Expand Down
2 changes: 1 addition & 1 deletion requirements/install.pip
Expand Up @@ -45,6 +45,6 @@ voluptuous==0.10.5
wtforms-json==0.3.1
wtforms==2.1
xmltodict==0.11.0
geojson>=1.3.1
geojson==2.1.0
pymongo==3.4.0
Jinja2==2.9.6
7 changes: 4 additions & 3 deletions udata/core/spatial/forms.py
Expand Up @@ -48,9 +48,10 @@ def process_formdata(self, valuelist):

def pre_validate(self, form):
if self.data:
result = geojson.is_valid(self.data)
if result['valid'] == 'no':
raise validators.ValidationError(result['message'])
if not isinstance(self.data, geojson.GeoJSON):
raise validators.ValidationError('Not a valid GeoJSON')
if not self.data.is_valid:
raise validators.ValidationError(self.data.errors())
return True


Expand Down

0 comments on commit eea823b

Please sign in to comment.