This is now fixed in trunk. For the moment I'm depending on SQLAlchemy
trunk for the new after_attach hook until beta3 is released.
Maybe it's time to start depending on 0.5?
Laurence
Brandon Craig Rhodes wrote:
I complained recently about problems with things disappearing from an
in-memory sqlite database. It appears that my problems were actually
symptoms of something else: that, so far as I can see, doing a
transaction.commit()
when SQLAlchemy is active does *not* first do a session().commit()!
This means that the following sequence in a test suite:
>>> p = Person(name='Brandon')
>>> s = session()
>>> s.add(p)
>>> transaction.commit()
>>> s.attribute = 'an illegal value'
Traceback:
...
Exception: the database does not allow that attribute to have that value
>>> transaction.rollback()
Instead, to make this work, one has to write the first stanza as:
>>> p = Person(name='Brandon')
>>> s = session()
>>> s.add(p)
>>> s.flush() # Sheesh
>>> transaction.commit()
Could zope.sqlalchemy be improved so that, on transaction commit, the
current SQLAlchemy session is first flushed before being committed?
_______________________________________________
Zope-Dev maillist - Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )