cablegates/pandora/urlalias/views.py

22 lines
504 B
Python
Raw Normal View History

2011-01-18 15:30:49 +00:00
# Create your views here.
2011-02-22 16:52:03 +00:00
from django.shortcuts import get_object_or_404, redirect
2011-01-18 15:30:49 +00:00
import models
2011-02-22 16:52:03 +00:00
def padma_video(request, url):
url = url.split('/')
hid = url[0]
if len(url) > 1:
view = url[1]
else:
view = None
2011-01-18 15:30:49 +00:00
alias = get_object_or_404(models.IDAlias, old=hid)
url = '/%s' % alias.new
if view:
url += '/' + {
2011-02-22 16:52:03 +00:00
'editor': 'timeline',
2011-01-18 15:30:49 +00:00
}.get(view, view)
#FIXME: reqire layer urls, reqrite timerange urls
2011-02-22 16:52:03 +00:00
return redirect(url)
2011-01-18 15:30:49 +00:00