Three issues about the threading:
1) threading.currentThread() returns a new-style object, so for simple needs, you can just add attr's to it.
2) If you're going to roll your own mapping keyed off of currentThread(), you might as well skip all of the threading-module overhead and just use thread.get_ident() directly.
3) I've had serious issues with e.g. mod_python reusing thread id's in concurrently running threads (!). So be careful. One of these days, I need to track that buglet down... :(