[Zope3-Users] Scheduler package usage

Brian Sutherland jinty at web.de
Thu Nov 23 15:16:21 EST 2006


On Wed, Nov 22, 2006 at 08:12:45AM +1100, Tom Dossis wrote:
> Thierry Florac wrote:
> > 
> > But now I have to face another problem : tasks are executed outside of
> > any request or context environment ; because of this, components lookups
> > always fail !
> > So I'd like to know :
> >  - how can I handle transactions ?
> 
> I expect the normal explicit transaction calls to work, but not that
> I've used the scheduler myself:
> 
>   import transaction
>   transaction.commit()
> or
>   transaction.abort()

I used this pattern when working with the scheduler:

    transaction.begin()
    try:
        ...
        transaction.commit()
    except:
        transaction.abort()
        raise

Not sure if it's exactly correct though.

-- 
Brian Sutherland

Metropolis - "it's the first movie with a robot. And she's a woman.
              And she's EVIL!!"


More information about the Zope3-users mailing list