warn during system check it shapely speedups are not available

This commit is contained in:
Laura Klünder 2017-10-20 16:11:40 +02:00
parent 49bc5f013d
commit 5ede164761
2 changed files with 17 additions and 2 deletions

View file

@ -1,6 +1,7 @@
from itertools import chain
import matplotlib.pyplot as plt
from django.core import checks
from matplotlib.patches import PathPatch
from matplotlib.path import Path
from shapely import speedups
@ -10,6 +11,20 @@ if speedups.available:
speedups.enable()
@checks.register()
def check_svg_renderer(app_configs, **kwargs):
errors = []
if not speedups.available:
errors.append(
checks.Warning(
'Your shapely version does not have speedups enabled. This will significantly slow down c3nav!',
obj='rtree.index.Index',
id='c3nav.mapdata.W001',
)
)
return errors
def clean_geometry(geometry):
"""
if the given geometry is a Polygon and invalid, try to make it valid if it results in a Polygon (not MultiPolygon)

View file

@ -62,9 +62,9 @@ def check_svg_renderer(app_configs, **kwargs):
if not rtree_index:
errors.append(
checks.Warning(
'The libspatialindex_c library is missing. This will drastically slow down c3nav rendering.',
'The libspatialindex_c library is missing. This will slow down c3nav in future versions.',
obj='rtree.index.Index',
id='c3nav.mapdata.W001',
id='c3nav.mapdata.W002',
)
)
return errors