[storm] RFC: Storm with Pylons and Repoze.tm2
James Henstridge
james at jamesh.id.au
Tue Jul 29 03:37:18 BST 2008
On Tue, Jul 29, 2008 at 2:39 AM, Olaf Conradi <olaf at conradi.org> wrote:
> 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?
Well, it all depends on how much can be shared and how much needs to
be different.
>
>> 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
Is zope.testing such a bad dependency?
> ZODB.POSException import TransactionFailedError)
> TransactionFailedError is in transaction.interfaces too.
We should probably try to import the exception from
transaction.interfaces first. We still have some projects using older
versions of Zope that don't have the exception in
transaction.interfaces, so it'd be good to keep the ZODB import for
compatibility's sake.
[upgrading said projects is on the todo list]
> I think global_zstorm = ZStorm() and addCleanUp(global_zstorm._reset)
> should be in a separate file, like I did with storm.tm.session.
You have a global TMStorm object in your branch too. Is there any
reason why you wouldn't want to reuse the global_zstorm instance?
>
>> 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.
James.
More information about the storm
mailing list