[storm] RFC: Storm with Pylons and Repoze.tm2

Olaf Conradi olaf at conradi.org
Mon Jul 28 19:39:38 BST 2008


Hi,

2008/7/28 James Henstridge <james at jamesh.id.au>:
> On Mon, Jul 28, 2008 at 12:29 AM, Olaf Conradi <olaf at conradi.org> wrote:
>> Hello,
>>
>> I modified the Zope module for Storm to use repoze.tm2 as transactions
>> and add a middleware layer for use with Pylons.
>
> This sounds like a useful feature, although I do worry about the code
> duplication.  I've been looking at using Storm with Django recently,
> and am reusing the Zope transaction manager there too (since Django
> doesn't offer any kind of global TM).
>
> Repeating all the synchronizer/data manager code for each of these
> systems would mean that problems would need to be fixed multiple times
> instead of once (and there are things I'd like to see changed in the
> way we hook up stores to the TM).

I duplicated the code as a proof of concept. We could move the generic
parts to a new package.

Something like storm.transaction and create zstorm.py for zope and
tmstorm.py for repoze.tm.
And put the helper classes in a separate file, transaction.py or
something like that?

> Was there anything preventing you from using the ZStorm class directly
> for your purposes?  You could probably still use the Paste registry as
> a way of accessing the singleton rather than the Zope's utility
> system.

I don't have zope installed on my system and for repoze.tm2 I just
need the zope transaction package.
(from zope.testing.cleanup import addCleanUp and from
ZODB.POSException import TransactionFailedError)
TransactionFailedError is in transaction.interfaces too.

I think global_zstorm = ZStorm() and addCleanUp(global_zstorm._reset)
should be in a separate file, like I did with storm.tm.session.

> As for the actual code in your branch, it needs tests.  This will be
> less of a problem if you can reuse the existing tested code more
> though :)

Yeah, I knew this response would come ;)
I'll have a go at it.

 -Olaf



More information about the storm mailing list