Non-working BelongsTo.clear
himikof opened this issue · 2 comments
himikof commented
If a BelongsTo relationship is cleared, the foreign-key atrribute is set to None
, but such attributes are ignored during save()
. The
test_clear_belongs_to
is broken because it does not call refresh, it checks only in-memory value. This testcase demonstrates the problem:
@inlineCallbacks
def test_clear_belongs_to(self):
picture = yield Picture(name="a pic", size=10, user_id=self.user.id).save()
yield picture.user.clear()
user = yield picture.user.get()
self.assertEqual(user, None)
yield picture.refresh()
user = yield picture.user.get()
self.assertEqual(user, None)
bmuller commented
This is a bug. Fixing now...