Commit 1303e12c authored by waylon's avatar waylon

fix E117,F632 after pydocestyle update.

parent b0e09ea4
...@@ -19,7 +19,7 @@ class GeoJSONField(JSONField): ...@@ -19,7 +19,7 @@ class GeoJSONField(JSONField):
super(GeoJSONField, self).__init__(label, validators, **kwargs) super(GeoJSONField, self).__init__(label, validators, **kwargs)
self.web_srid = 4326 self.web_srid = 4326
self.srid = srid self.srid = srid
if self.srid is -1: if self.srid == -1:
self.transform_srid = self.web_srid self.transform_srid = self.web_srid
else: else:
self.transform_srid = self.srid self.transform_srid = self.srid
...@@ -30,7 +30,7 @@ class GeoJSONField(JSONField): ...@@ -30,7 +30,7 @@ class GeoJSONField(JSONField):
if self.raw_data: if self.raw_data:
return self.raw_data[0] return self.raw_data[0]
if type(self.data) is geoalchemy2.elements.WKBElement: if type(self.data) is geoalchemy2.elements.WKBElement:
if self.srid is -1: if self.srid == -1:
return self.session.scalar(func.ST_AsGeoJson(self.data)) return self.session.scalar(func.ST_AsGeoJson(self.data))
else: else:
return self.session.scalar( return self.session.scalar(
...@@ -43,7 +43,7 @@ class GeoJSONField(JSONField): ...@@ -43,7 +43,7 @@ class GeoJSONField(JSONField):
def process_formdata(self, valuelist): def process_formdata(self, valuelist):
super(GeoJSONField, self).process_formdata(valuelist) super(GeoJSONField, self).process_formdata(valuelist)
if str(self.data) is '': if str(self.data) == '':
self.data = None self.data = None
if self.data is not None: if self.data is not None:
web_shape = self.session.scalar( web_shape = self.session.scalar(
......
...@@ -17,7 +17,7 @@ def geom_formatter(view, value): ...@@ -17,7 +17,7 @@ def geom_formatter(view, value):
"data-tile-layer-url": view.tile_layer_url, "data-tile-layer-url": view.tile_layer_url,
"data-tile-layer-attribution": view.tile_layer_attribution "data-tile-layer-attribution": view.tile_layer_attribution
}) })
if value.srid is -1: if value.srid == -1:
value.srid = 4326 value.srid = 4326
geojson = view.session.query(view.model).with_entities(func.ST_AsGeoJSON(value)).scalar() geojson = view.session.query(view.model).with_entities(func.ST_AsGeoJSON(value)).scalar()
return Markup('<textarea %s>%s</textarea>' % (params, geojson)) return Markup('<textarea %s>%s</textarea>' % (params, geojson))
......
...@@ -363,8 +363,8 @@ class ModelView(BaseModelView): ...@@ -363,8 +363,8 @@ class ModelView(BaseModelView):
# Check type # Check type
if (field_type not in self.allowed_search_types): if (field_type not in self.allowed_search_types):
raise Exception('Can only search on text columns. ' + raise Exception('Can only search on text columns. ' +
'Failed to setup search for "%s"' % p) 'Failed to setup search for "%s"' % p)
self._search_fields.append(p) self._search_fields.append(p)
......
...@@ -217,8 +217,8 @@ class ModelView(BaseModelView): ...@@ -217,8 +217,8 @@ class ModelView(BaseModelView):
# Check type # Check type
if not isinstance(p, (CharField, TextField)): if not isinstance(p, (CharField, TextField)):
raise Exception('Can only search on text columns. ' + raise Exception('Can only search on text columns. ' +
'Failed to setup search for "%s"' % p) 'Failed to setup search for "%s"' % p)
self._search_fields.append(p) self._search_fields.append(p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment