[ZODB-Dev] how to get root obj from a new transaction?

Claudiu Saftoiu csaftoiu at gmail.com
Wed May 2 16:49:32 UTC 2012


Hey all,

I'm using a thread to do some server-side work. The thread will be asked by
different
requests to do the same thing at the same time, so I want the thread to do
all the work
once and return the data to the requests. The problem is that the requests
each have
their own transaction and the thread essentially has none.

I can communicate between the two only using identifiers - not persistent
objects - that
way the thread can process data in a different transaction than the
requests yet still
return a meaningful reply. However, the thread has to start a new
transaction each
time it processes something - which I know how to do:

    while True:
        #wait until asked to do something
        import transaction
        transaction.begin()

However, the thread needs access to the root object in order to turn the
identifiers
gotten from the requests into persistent objects... how would I go about
accessing
the root object in such a circumstance?

Thanks,
- Claudiu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.zope.org/pipermail/zodb-dev/attachments/20120502/62da4a38/attachment.html>


More information about the ZODB-Dev mailing list