detect and skip erroneous layers (#48949)
This commit is contained in:
parent
d9762e6683
commit
5bf278e014
|
@ -26,6 +26,7 @@ from combo.data.models import Page, ConfigJsonCell
|
|||
|
||||
class Command(BaseCommand):
|
||||
def handle(self, *args, **options):
|
||||
verbosity = options.get('verbosity')
|
||||
places_page = Page.objects.get(slug='lieux')
|
||||
for layer in MapLayer.objects.all():
|
||||
json_cell_type = settings.JSON_CELL_TYPES.get(layer.slug)
|
||||
|
@ -43,7 +44,12 @@ class Command(BaseCommand):
|
|||
parent_page.title = layer.label
|
||||
parent_page.save()
|
||||
layer.properties = None # get all properties
|
||||
for feature in layer.get_geojson(request=None)['features']:
|
||||
resp = layer.get_geojson(request=None)
|
||||
if isinstance(resp['features'], dict) and resp['features'].get('err'):
|
||||
if verbosity:
|
||||
self.stderr.write('error in layer %s: %r\n' % (layer, resp['features']))
|
||||
continue
|
||||
for feature in resp['features']:
|
||||
cell_parameters = dict([
|
||||
(x, feature['properties'][x]) for x in feature['properties'] if x in cell_form_keys])
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue