A.M. Kuchling wrote: > On Wed, Jan 07, 2004 at 11:13:29PM -0500, Graham Fawcett wrote: > >>Unless Medusa is under serious, active development (?) ... > > I'm maintaining it, but applying only bugfixes. One major problem is that > Medusa doesn't support SSL and fixing this is difficult; as a result I > switched from Medusa to Twisted for a work-related project because SSL > support was required. (Luckily your quixote.server.twisted_http module > makes that trivial.) Glad to hear it! I wasn't sure if the module was getting any use. > > If someone needs fancy HTTP/1.1 features, they can use a full-blown web > server such as Apache. > > Another thing I'd like to see, and will write if Medusa goes in: a module > that runs a Quixote application on a random port and then uses > webbrowser.open() to run a browser pointing at the application. This would > make it really easy to write portable little applications. Shutting down > the server is a problem, though; the user might just close the browser and > leave the server process running. Perhaps the server could automatically > shutdown after 15 or 30 minutes of inactivity, in addition to having an > explicit 'Shut down' link in the web interface. That's a great idea. On Windows, I've used the (non-portable) solution of using COM to dispatch a browser, and polling to see if it's still alive. I don't know too much about the webbrowser module; does it return a pid for the browser process? Imperfect, but it would beat a timeout. >>If there's no great objection, I will prepare a 'quixote.server.medusa' >>package >>that contains only the required Medusa elements (and perhaps moving >>medusa_http.py into the package as well?) and recommend we include it in >>the next release. > > OK. I could also prepare quixote.server.medusa, though not before the > weekend because for the moment I'm computerless at home. I've created a patchfile (-p0) that should add the quixote.server.medusa subpackage. Apparently it's too big for the maillist, so I put it at: http://fawcett.medialab.uwindsor.ca/quixote/medusa.patch For fellow Windows testers, an archive of these files is (temporarily) located at http://fawcett.medialab.uwindsor.ca/quixote/medusa_patch.tar.gz There are a few extra files that I hadn't realized were needed (Sam didn't put all his imports at the top of his source files...). xmlrpc_handler is in there, and a few other utility files needed for logging (which eventually could be stripped out). I also added a submodule, server.py, which is a copy of medusa_http.py with the addition of a convenience class, Server. Starting a Quixote app using this approach is as easy as: from quixote.server.medusa import Server s = Server('quixote.demo', port=8080) s.run() The signature of the Server constructor is: __init__(self, approot, config_file=None, port=80, enable_ptl=True) where enable_ptl is a truth value; it will automatically import and enable PTL if set to a true value. Comments welcome! -- Graham