Skip to content

Commit

Permalink
Redirecting URL from previous names to caravel
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Mar 31, 2016
1 parent bd9051a commit 2b71b72
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions caravel/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import pandas as pd
from sqlalchemy import select, text
from sqlalchemy.sql.expression import TextAsFrom
from werkzeug.routing import BaseConverter

from caravel import appbuilder, db, models, viz, utils, app, sm, ascii_art

Expand Down Expand Up @@ -823,3 +824,23 @@ class CssTemplateModelView(CaravelModelView, DeleteMixin):
icon="fa-css3",
category="Sources",
category_icon='')


# ---------------------------------------------------------------------
# Redirecting URL from previous names
class RegexConverter(BaseConverter):
def __init__(self, url_map, *items):
super(RegexConverter, self).__init__(url_map)
self.regex = items[0]
app.url_map.converters['regex'] = RegexConverter


@app.route('/<regex("panoramix\/.*"):url>')
def panoramix(url): # noqa
return redirect(request.full_path.replace('panoramix', 'caravel'))


@app.route('/<regex("dashed\/.*"):url>')
def dashed(url): # noqa
return redirect(request.full_path.replace('dashed', 'caravel'))
# ---------------------------------------------------------------------

0 comments on commit 2b71b72

Please sign in to comment.