durusmail: durus-users: Re: Using Durus with Pylons
 
Re: Using Durus with Pylons
2006-12-18
Mike Orr (2 parts)
Re: Using Durus with Pylons
Mike Orr
2006-12-18
Here's what I ended up with for persistent thread-local Durus
connections in Pylons.  It works in my test, using a TCP socket to the
database server and doing multiple requests until a thread is reused.
Are there any flaws in the coding?

Is CONFIG["global_conf"]{"__file__"] the best way to get the config
file's path?  Will it always be defined?

To test if the socket is still alive, I do a makeshift "version"
command to the server.  I think Durus ClientStorage needs a dedicated
method for this.  (.ping() or .is_connected())  (Note: this catches
IOError if the server has been killed or restarted.)

Is there a way to do the equivalent of thread.get_ident() from the
threading module or Thread objects?  This seems to be the only way to
get a thread ID.

Is there a way to get an application instance ID to distinguish
between multiple instances of the same application?  This is not the
same as id(the_controller), which would change every request.

--
Mike Orr 
reply