I do not see any reference to mark_changed you have to call it before any transaction.commit() to tell the zope transaction machinery that it has to commit you changes also. robert Maric Michaud schrieb:
Hi all,
I wanted to use SQALchemyDA with a standalone Zope 2.11 (we only depends on CMFCore).
i tried to get it up using easy_install, which is pretty straightforward, once removed the incompatible zope.component package needed in the dependencies.
It ends up with the following installed packages (skipping zope 3 components) : zope.sqlalchemy-0.4-py2.4.egg z3c.sqlalchemy-1.3.10.1-py2.4.egg SQLAlchemy-0.5.5-py2.4.egg Products.SQLAlchemyDA-0.4.1-py2.4.egg
At first glance, this works well, but the DA actually can't manage to commit any sql requests (I try only for insert in Mysql and postgres but I'm sure it's always true).
This is quite an unexpectable behavior for a DA.
I think the problem is related to this thread I found on tg-trunk newsgroup :
http://www.mail-archive.com/turbogears-trunk@googlegroups.com/msg07302.html
There is a misleading comment in the docstring of zope.sqlalchemy.datamanager.join_transaction speaking of a DirtyAfterFlush SessionExtension, which I never seen except in plone code.
In the last I finally manage to make it work by monkey patching SQLAlchemyDA itself this way :
try : from Products.SQLAlchemyDA import da from z3c.sqlalchemy import getSAWrapper, createSAWrapper if '0.4.1' in da.__file__ and not hasattr(da.SAWrapper, '_patched__wrapper_property') : da.SAWrapper._patched__wrapper_property = da.SAWrapper._wrapper
def _always_invalidated_wrapper(self): """The property '_wrapper' patched by CFENet to correct what seems to be a bug in SQLAlchemyDA which prevents any commit.""" from zope.sqlalchemy.datamanager import STATUS_INVALIDATED if self.dsn: try: return getSAWrapper(self.util_id) except ValueError: return createSAWrapper( self.dsn, forZope=True, transactional=self.transactional, engine_options={'convert_unicode' : self.convert_unicode, 'encoding' : self.encoding}, extension_options={'initial_state': # the whole # point is here STATUS_INVALIDATED}, name=self.util_id) return None
da.SAWrapper._wrapper = property(_always_invalidated_wrapper)
except ImportError : pass
Anyone has any insights about this problem, any comments on my solution, did it have been reported and corrected, or am I simply missing something ?