Hi Arturo, On Wed, Dec 19, 2012 at 12:29 AM, Arturo Filastò <[email protected]> wrote:
> We are currently using Storm for an open source application: > https://github.com/globaleaks/GLBackend. > > Are any of the projects you mentioned above open source? > > We are especially interested in using Storm with Twisted and > having pieces of code that demonstrate it's proper usage would > be of great help. I had a very quick look to your code base and it seems you're already using storm.twisted.transact, which at the moment is the recommended way to integrate Storm with Twisted. So I take you understand why @transact is there and how to use it, and you seem also to have a docstring mentioning the importance of not returning a Storm object from a @transact-decorated method, which is the most important thing to watch for in this case. One thing that is not very clear to me after reading the docstring of TXModel is why do you return a new Store every time in getStore() and why do you recommend to rollback/close manually. The @transact decorator already takes care of committing if the decorated method succeeds, or rolling back in case the decorated method raises an exception. You might want to give a look at storm.zope and use ZStorm, which is essentially some glue code against the awesome zope.transaction package (don't be put off by the "zope." prefix) and will let you maintain a pool of opened stores using thread-local structures. E.g.: def getStore(self, operation_desc=''): # ... return zstorm.get("your-store-identifier") where zstorm is a properly configured instance of ZStorm. You might want to keep it in a global variable for easy of use, or pass it around as needed, or register it as a utility with zope.component. Cheers, Free -- storm mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/storm
