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
On Jan 17, 2008 6:59 PM, jason kirtland <[EMAIL PROTECTED]> wrote:
>
> Rick Morrison wrote:
> > I'm having trouble with the instrumented lists used for relation
> > collections:
> >
> >
> > def setProp(self, new_prop, exclusive=True):
> > self.props = [p for p if p.typ != new_prop.typ]
> > self.props.append(new_prop)
> >
> > so if 'props' is a relation on some mapped class, and I try
> > C.setProp(newprop), then a later flush() fails when it tries to write a
> > null FK in the properties table.
> >
> > I suspect it's the list comprehension when there's items in there that
> > haven't been flushed yet.
>
> What's the real code doing? That doesn't parse,..
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---