Wichert Akkerman wrote:
Previously Shane Hathaway wrote:
I think I want to use a threading.local as my site manager. That way, I can use a different configuration for each WSGI app even if several apps run in different threads of a single Python interpreter. It looks like the zope.app.component.hooks module does something like what I want, but that module is complicated and lacks comments in the places that matter, so I'm not quite sure what it accomplishes. I'll add comments to that module if anyone can explain it fully.
You can also use a paste.registry StackedObjectProxy to provide access to a thread local site manager via the standard wsgi environ. That certainly fits well with the WSGI model and other frameworks such as Pylons and Turbogears use it. I'm not sure if Zope3 exposes that properly though. Admitedly paste.registry is not the best documented code either; some cleanup there is still useful but the ideal model has not been worked out yet.
Thanks for the pointer. I'm not quite sure how StackedObjectProxy might fit in, but if it turns out I need it, at least now I don't have to rewrite it.
That led me to the zope.thread module, which is apparently deprecated already, yet zope.app.component still depends on it. Is that an hysterical accident?
I only learned yesterday that zope.thread is now basically just a wrapper around python 2.4's threading module so you can use that directly.
Fred Drake also confirmed that nothing needs to use zope.thread anymore. I plan to clean it up. Shane