dont return json 404 for non existing old ids
This commit is contained in:
parent
1ac95407f8
commit
2ff13690f8
1 changed files with 12 additions and 4 deletions
|
@ -4,6 +4,8 @@ import re
|
||||||
|
|
||||||
from django.shortcuts import get_object_or_404, redirect
|
from django.shortcuts import get_object_or_404, redirect
|
||||||
|
|
||||||
|
import app.views
|
||||||
|
|
||||||
import models
|
import models
|
||||||
|
|
||||||
def padma_find(request):
|
def padma_find(request):
|
||||||
|
@ -49,11 +51,17 @@ def padma_video(request, url):
|
||||||
layer = view
|
layer = view
|
||||||
view = None
|
view = None
|
||||||
if layer:
|
if layer:
|
||||||
|
try:
|
||||||
alias = get_object_or_404(models.LayerAlias, old=layer)
|
alias = get_object_or_404(models.LayerAlias, old=layer)
|
||||||
url = '/%s' % alias.new
|
url = '/%s' % alias.new
|
||||||
|
except:
|
||||||
|
return app.views.index(request)
|
||||||
else:
|
else:
|
||||||
|
try:
|
||||||
alias = get_object_or_404(models.IDAlias, old=hid)
|
alias = get_object_or_404(models.IDAlias, old=hid)
|
||||||
url = '/%s' % alias.new
|
url = '/%s' % alias.new
|
||||||
|
except:
|
||||||
|
return app.views.index(request)
|
||||||
if view:
|
if view:
|
||||||
timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view)
|
timecodes = re.compile('(\d{2}:\d{2}:\d{2}\.\d{3})-(\d{2}:\d{2}:\d{2}\.\d{3})').findall(view)
|
||||||
if timecodes:
|
if timecodes:
|
||||||
|
|
Loading…
Reference in a new issue