bmuller / twistar

Twistar is an object-relational mapper (ORM) for Python that uses the Twisted library to provide asynchronous DB interaction.
http://findingscience.com/twistar
Other
132 stars 38 forks source link

Non-working BelongsTo.clear #14

Closed himikof closed 13 years ago

himikof commented 13 years ago

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 13 years ago

This is a bug. Fixing now...

bmuller commented 13 years ago

Fixed in 165d422