Patch attached.  It fixes the test case you provided.  Michael, please take a look and see if you approve of what I did.  I have not run the SA test suite against this patch so it could possibly break something.

Hey at least I tried! <grin/>

Tim

On 11/9/06, Pete Taylor <[EMAIL PROTECTED]> wrote:
Hi all,

I've run into a bit of an issue with session.flush()'s orphan
tracking.  Although I know for certain that my objects have been run
through session.save_or_update(), when I actually call session.flush,
i run into this:
---
  File "/usr/lib/python2.4/site-packages/sqlalchemy-svn/lib/sqlalchemy/orm/mapper.py",
line 226, in _is_orphan
    raise exceptions.FlushError("instance %s is an unsaved, pending
instance and is an orphan (is not attached to any parent '%s' instance
via that classes' '%s' attribute)" % (obj, klass.__name__, key))
sqlalchemy.exceptions.FlushError: instance <__main__.Address object at
0xb7cb6a2c> is an unsaved, pending instance and is an orphan (is not
attached to any parent 'Business' instance via that classes' 'address'
attribute)

---

now, I know it's attached to a session, and it's not an orphan.  I've
created a test case and attached it that can perhaps better explain,
but in effect, I have multiple objects that may or may not have an
"address" in one of their relationships.  It seems like the _is_orphan
method is not checking all objects in session.dirty or session.new to
see if the object that *could* fulfill a relationship is actually
meant to fulfill that particular relationship.

any help would be appreciated!
Pete

--
"All guilt is relative, loyalty counts, and never let your conscience
be your guide."
  - Lucas Buck, American Gothic



--~--~---------~--~----~------------~-------~--~----~
 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
-~----------~----~----~----~------~----~------~--~---

Attachment: mapper.patch
Description: Binary data

Reply via email to