Ash wrote:
> OK, the a.b bit might be related.
>
> We do something like this:
>
> host = Host.query.filter_by(hostname=hostname).one()
> note = Note(
>     host = host,
>     message = foo,
>     ...
> )
>   
IIRC the problem was more along the lines of:

    * if there is a cascade update (or something like that) and
    * you .save() an object holding a reference to another object
    * then the held object is *also* added to the session
    * attempts to add the object in the future will fail (in 0.4)

note = Note( )
host = Host( notes = [ note ])
DBSession.add( host )
DBSession.add( note ) # blew up, IIRC

that is, your code fragment looks fine, though honestly I may be
mis-remembering how the error was triggered.

Good luck,
Mike

-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com


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

Reply via email to