From f4b1eb993a73d746fbfe8e2a028c363779888289 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20K=C3=B6gl?= Date: Thu, 4 Jun 2015 12:03:09 +0200 Subject: [PATCH] [Episodes] handle objects passed to update_episode_state --- mygpo/episodestates/tasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mygpo/episodestates/tasks.py b/mygpo/episodestates/tasks.py index ded3c184..0a330560 100644 --- a/mygpo/episodestates/tasks.py +++ b/mygpo/episodestates/tasks.py @@ -11,7 +11,13 @@ logger = get_task_logger(__name__) def update_episode_state(historyentry_pk): """ Updates the episode state with the saved EpisodeHistoryEntry """ - historyentry = EpisodeHistoryEntry.objects.get(pk=historyentry_pk) + # previously an EpisodeHistoryEntry was passed as parameters directly; + # as there can still be tasks like this in the queue, we should still + # be able to handle it + if isinstance(historyentry_pk, EpisodeHistoryEntry): + historyentry = historyentry_pk + else: + historyentry = EpisodeHistoryEntry.objects.get(pk=historyentry_pk) user = historyentry.user episode = historyentry.episode -- 2.11.4.GIT