From d6c6e67991254ba37ffaea401cb0b73a77ecd7bf Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 28 Sep 2012 15:57:43 -0400 Subject: [PATCH] Fix mit_sync_table to run after we save zephyrs. (imported from commit 7522a0f9eb5a4ab99434284c65382b5460abe4d7) --- zephyr/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/zephyr/models.py b/zephyr/models.py index 4dc4896620..f427d2f894 100644 --- a/zephyr/models.py +++ b/zephyr/models.py @@ -264,8 +264,11 @@ def log_zephyr(zephyr): fcntl.flock(lock, fcntl.LOCK_UN) def do_send_zephyr(zephyr, synced_from_mit=False, no_log=False): - mit_sync_table[zephyr.id] = synced_from_mit zephyr.save() + # The following mit_sync_table code must be after zephyr.save() or + # otherwise the id returned will be None (not having been assigned + # by the database yet) + mit_sync_table[zephyr.id] = synced_from_mit # Log the message to our message log for populate_db to refill if not no_log: log_zephyr(zephyr)