Hi. Can I ask why you call the emit(‘register-transaction’) in your store object?
-- Join the free software foundation and become free as in freedom On 31 March 2014 at 19:02:37, R Pish ([email protected]) wrote: Hi, I started using zstorm very recently and I was very interested on using zstorm. After investigating, I was able to put some code and get it working, but I am having an issue with registrating the store into the transaction. The following is my code: from zope.component import provideUtility, getUtility import transaction from storm.zope.interfaces import IZStorm from storm.zope.zstorm import global_zstorm provideUtility(global_zstorm, IZStorm) zstorm = getUtility(IZStorm) zstorm.set_default_uri("test", database_dsn) # database_dsn is a variable that contains the mysql db dsn store = zstorm.get("test") store._event.emit("register-transaction") # I look for a user in my users table in order to make an update user = store.find(User, User.login == loginvar).one() user.token = u"Some test token for now" user.token_expires = session_timeout # assume that session_timeout is a variable with a valid timestamp transaction.commit() My problem is that if I use transaction.commit(), then the record is not updated in the database. But, if I use store.commit(), then the records does get updated. Why transaction.commit() is not working? Am I missing something? Thanks in advance. -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
-- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
