raise Http404 if warehouse or cube have disappeared (fixes #14319)

This commit is contained in:
Benjamin Dauvergne 2017-02-21 21:57:20 +01:00
parent 3dc8d9e494
commit 640979e348
1 changed files with 7 additions and 2 deletions

View File

@ -21,6 +21,7 @@ from collections import OrderedDict
from django.utils.translation import ugettext_lazy as _
from django.core.cache import cache
from django.http import Http404
from ..utils import get_warehouses, human_join
from ..engine import Engine
@ -52,8 +53,12 @@ class Visualization(object):
if d['warehouse'] == warehouse.name:
break
else:
raise LookupError('warehouse %s not found' % d['warehouse'])
cube = Engine(warehouse)[d['cube']]
raise Http404('warehouse %s not found' % d['warehouse'])
engine = Engine(warehouse)
try:
cube = engine[d['cube']]
except KeyError:
raise Http404('cube %s not found' % d['cube'])
representation = d['representation']
measures = [cube.measures[name] for name in d['measures']]
drilldown = [cube.dimensions[name] for name in d.get('drilldown', [])]