fixed error in get_active_slide()

This commit is contained in:
Oskar Hahn 2012-04-17 12:07:32 +02:00
parent 131d84bee4
commit 6aa241b268

View File

@ -4,7 +4,10 @@ from django.template.loader import render_to_string
def split_sid(sid): def split_sid(sid):
try:
data = sid.split('-') data = sid.split('-')
except AttributeError:
return None
if len(data) == 2: if len(data) == 2:
model = data[0] model = data[0]
id = data[1] id = data[1]
@ -18,7 +21,11 @@ def split_sid(sid):
def get_slide_from_sid(sid): def get_slide_from_sid(sid):
try:
key, id = split_sid(sid) key, id = split_sid(sid)
except TypeError:
return None
if id is not None: if id is not None:
return SLIDE[key].model.objects.get(pk=id).slide() return SLIDE[key].model.objects.get(pk=id).slide()
try: try: