dont fail if no frame is selected

This commit is contained in:
j 2011-09-30 03:20:47 +02:00
parent 1fa04cec95
commit 3a610c6187

View file

@ -460,8 +460,9 @@ class Item(models.Model):
if keys and 'frames' in keys: if keys and 'frames' in keys:
i['frames'] = frames i['frames'] = frames
if frames: selected_frame = filter(lambda f: f['selected'], frames)
i['posterFrame'] = filter(lambda f: f['selected'], frames)[0]['position'] if selected_frame:
i['posterFrame'] = selected_frame[0]['position']
elif self.poster_frame != -1.0: elif self.poster_frame != -1.0:
i['posterFrame'] = self.poster_frame i['posterFrame'] = self.poster_frame