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

Olaf Conradi olaf at conradi.org
Tue Jul 29 00:09:01 BST 2008


2008/7/28 Olaf Conradi <olaf at conradi.org>:
> 2008/7/28 Olaf Conradi <olaf at conradi.org>:
>> 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.


Oh, I almost forgot. The biggest problem is storm.zope.__init__.py.
It depends on zope.security. That's why I copied ZStorm as TMStorm to storm.tm.

Can't we create a minimal storm.tm.TMStorm and let  storm.zope.ZStorm
inherit from it.
zstorm.py will only create the global_zstorm object and register the cleanup.
Existing implementations that already use global_zstorm will continue
to work without modification.
Any exceptions will be rethrown as the original Z* exceptions.


>
> Ehm, I meant I just need zope.interface and transaction, next to repoze.tm2.
>
> The following is Zope specific:
>> (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