[orm-devel] one2one relationship's behavior when reassigning (was: Bug or feature in relationships.py)
Diedrich Vorberg
orm-devel@mailman.tux4web.de
Mon, 17 Feb 2003 23:44:43 +0100
Hi Mike!
>Line 172 of relationships.py in the set method of one2oneColumn contains:
> if self._data: self._data.delete()
Mike's
> is a slightly different use case than what (I think) one2one
>envisions. The example Diedrich uses is a photograph to a person. I guess I
>can see deleting a photograph row if the persons photo is being replaced
>with another, so the delete that happens in lock step with the status_id
>attribute reassignment could make sense.
Orm thinks in objects. So a one2one relationship is a relationship
between objects. Deleting the parent also deletes the child as
>>> del obj
also deletes obj's attributes... if obj is the only reference to
them.
>When a document has its status changed, the relationship between Document
>and a row in Status should change, but no rows in Status should be deleted.
I can see that...
>one2one functionally delivers all that is needed with the important
>exception of that delete happening on line 172. I guess I could just
>subclass it and modify its behaviour for myself but I imagine I'm not the
>only person with this need so here I am raising this.
and I too think subclassing is a good idea. It is a new kind of for orm
relation and should get a good name. From your eMail I guess 'lookup'
suggests itself. At the company I used to work for these were
referred to as 'domain tables", so perhaps 'domain' or 'domain_table'
would be a good idea. What do you think?
Diedrich
--
_..._ Diedrich Vorberg
.' '.
/ _ _ \ http://www.tux4web.de
| (o)_(o) | info@tux4web.de
\( ) / .---.
//'._.'\ \ / \ Internet Dienstleistungen
// . \ \ \.@-@./ und 'Consulting'.
|| . \ \ /`\_/`\
|\ : / | // _ \\ Linux Rules!
\ `) ' (` /_ | \ )|_
_)``".____,.'"` (_ /`\_`> <_/ \
) )'--'( ( \__/'---'\__/
'---` `---`