Skip to content

Commit

Permalink
pass the request arg in the /caravel/slices/<slice_id>/ endpoint.
Browse files Browse the repository at this point in the history
remove unused import.
  • Loading branch information
williaster committed Aug 2, 2016
1 parent aaef338 commit 6808aed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,7 +1141,9 @@ def slice(self, slice_id):
qry = session.query(models.Slice).filter_by(id=int(slice_id))
slc = qry.first()
if slc:
return redirect(slc.slice_url)
url = '{slc.slice_url}&standalone={standalone}'.format(
slc=slc, standalone=request.args.get('standalone', False))
return redirect(url)
else:
flash("The specified slice could not be found", "danger")
return redirect('/slicemodelview/list/')
Expand Down
7 changes: 6 additions & 1 deletion tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,14 @@ def test_slices(self):
for slc in db.session.query(Slc).all():
urls += [
(slc.slice_name, 'slice_url', slc.slice_url),
(slc.slice_name, 'slice_id_endpoint', '/caravel/slices/{}'.format(slc.id)),
(slc.slice_name, 'json_endpoint', slc.viz.json_endpoint),
(slc.slice_name, 'csv_endpoint', slc.viz.csv_endpoint),
(slc.slice_name, 'slice_id',
'/caravel/slices/{}/'.format(slc.id)),
(slc.slice_name, 'slice_id_standalone',
'/caravel/slices/{}/?standalone=true'.format(slc.id)),
(slc.slice_name, 'slice_id_not_standalone',
'/caravel/slices/{}/?standalone=false'.format(slc.id)),
]
for name, method, url in urls:
print("[{name}]/[{method}]: {url}".format(**locals()))
Expand Down

0 comments on commit 6808aed

Please sign in to comment.