From 0caacf05262875f4e1791fd88d45910ac66dfd74 Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Fri, 30 Mar 2007 05:09:36 +0000 Subject: api_lock(): When locking the MailList object, tell the SQLAlchemy session to expire the object. This way, when the MailList attributes are next accessed, the ORM will reload them from the database, getting any new values possibly set in other processes. This works better than trying to use always_refresh=True on the mapper, or trying to do a reload() because both of those approaches blow away locks. I'm not sure why this, but I suspect that it's because the identity map is handing us back a different object, rather than invalidating the object's attributes. --- Mailman/database/dbcontext.py | 1 + Mailman/testing/test_handlers.py | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) (limited to 'Mailman') diff --git a/Mailman/database/dbcontext.py b/Mailman/database/dbcontext.py index 66c021447..306e0b2bb 100644 --- a/Mailman/database/dbcontext.py +++ b/Mailman/database/dbcontext.py @@ -129,6 +129,7 @@ class DBContext(object): # Higher level interface def api_lock(self, mlist): + self.session.expire(mlist) # Don't try to re-lock a list if mlist.fqdn_listname in self._mlist_txns: return diff --git a/Mailman/testing/test_handlers.py b/Mailman/testing/test_handlers.py index f963fdf24..0e0a1bc54 100644 --- a/Mailman/testing/test_handlers.py +++ b/Mailman/testing/test_handlers.py @@ -1802,7 +1802,6 @@ Here is message %(i)d eq(mimemsg['to'], mlist.GetListEmail()) # BAW: this test is incomplete... - def test_send_i18n_digest(self): eq = self.assertEqual mlist = self._mlist -- cgit v1.3.1