CPE Chapter 5 + Cascading operations question + ORM Shootout
Gustavo Niemeyer
gustavo at niemeyer.net
Mon Jul 16 20:02:18 BST 2007
>> Not yet.. should be easy to support it, though, since we already have
>> a clear() method on references that will unlink them.
>
> Could you elaborate on how the clear method works please?
Sure. clear() will unlink objects. It doesn't remove the
involved objects though. If it's a many-to-one reference,
it will set the referencing key to None. If it's a many-to-many
relation, it will remove the row/object linking both objects.
Making it remove objects is possible, and easy, but I don't
know if that's a good default behavior. If you have people
reading books, and you say people.books.clear(), you don't
want to actually remove these books most of the times. You
just want to remove the relation between them.
Would anyone have insights on the issue?
> I will fix the code as you suggested (thanks for your assistance).
No problem! Hopefully that information will be available in the manual
in the near future, so it's good to see which kind of issue should
be better explained.
--
Gustavo Niemeyer
http://niemeyer.net
More information about the storm
mailing list