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
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()
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
two clarifications: in my case the relation cascade is 'all, delete-orphan'.
But in the case I'm running into, all of the children are unpersisted before
the flush.
and the exception I get is not a complaint about an orphan, it's a database
error when SA tries to persist the (typ='a') item, but
On Jan 17, 2008, at 7:32 PM, jason kirtland wrote:
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.
yeah just tell me what youd like to
Rick Morrison wrote:
On Jan 17, 2008 7:32 PM, jason kirtland [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
Rick Morrison wrote:
def setProp(self, new_prop, exclusive=True):
if exclusive:
self.props = [p for p if p.typ != new_prop.typ]
On Jan 17, 2008, at 7:36 PM, Rick Morrison wrote:
two clarifications: in my case the relation cascade is 'all, delete-
orphan'. But in the case I'm running into, all of the children are
unpersisted before the flush.
and the exception I get is not a complaint about an orphan, it's a
On Jan 17, 2008, at 7:51 PM, Rick Morrison wrote:
An expunge on an collection remove that creates an orphan wouldn't
be a surprise to me; I'm surprised that it doesn't do that now.
+1 for error on case 1 plus auto-remove in case 2
would the expunge happen at attribute change time or at
On Jan 17, 2008, at 8:03 PM, Michael Bayer wrote:
On Jan 17, 2008, at 7:51 PM, Rick Morrison wrote:
An expunge on an collection remove that creates an orphan wouldn't
be a surprise to me; I'm surprised that it doesn't do that now.
+1 for error on case 1 plus auto-remove in case 2
do your setProp() operation, then do this:
(added, unchanged, deleted) = MyClass.props.get_history(myobject)
to see whats actually in there. it should just be a collection of
added objects (and also, the correct objects).
Yep, so far so good. Two Prop items in 'added'
Then, use
OK, I get the basic idea; expunge isn't automatic. Let me rework the
setProp to get things running again here, and then I'll pick up the
discussion about that.
For the archives: This rework sidesteps the issue:
def setProp(self, prop, exclusive=True):
if exclusive:
curprops = [p
11 matches
Mail list logo