my code is still running on sqlalchemy .48, so if this has been
addressed in future versions - let me know!

lets say i have a one-to-many sqlalchemy relation, and loop an
attribute called items:

def cleanup( cart ):
    for item in cart.items:
        if item.qty == 0 :
            self.dbSession('write').delete( item )


once i call cleanup(cart) , how can i ensure that looping through
cart.items will not bring up the deleted items ?

if i loop through the cart.items again, I'll have None types where I
deleted

i found that if i do a flush() and expire() , i can avoid this

    for item in cart.items:
    ...
    self.dbSession('write').flush()
    self.dbSession('write').expire(cart)


Is this the best way to handle the situation ?  is there something
better ?

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" 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/pylons-discuss?hl=en.

Reply via email to