Rick Morrison wrote: > def setProp(self, new_prop, exclusive=True): > if exclusive: > self.props = [p for p if p.typ != new_prop.typ] > self.props.append(new_prop) > > o = MappedObject() > o.setProp(Prop(typ='a', val='b') > o.setProp(Prop(typ='b', val='c') > > MappedObject has a simple relation() for Prop. > > at flush() time, the prop for (typ='b') is saved, but the one for > (typ='a') throws an error on the database insert saying that > table.foreignkey is null
You'd need delete-orphan in the cascade for that relation to dispose of all of the instances you're discarding. But it looks like the trunk is still complaining about 'instance <...> is an unsaved, pending instance and is an orphan[...]'. I thought that condition had been changed to a warning or a no-op somewhere around 0.4.0, guess it didn't. I don't think the discussion about discarding unpersisted collection orphans made the hop onto the list (IRC only) - anyone have an opinion? I think I'm still in favor of quashing this exception. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---