I've updated SAM to now include a webserver. This brings along with it a new AJAXy interface (I guess this is sort of a followup to my AJAX post, Alex (dojo) and Bob (mochikit) were the only open source people who responded to my requests for comments (one commercial company started the interview process but ended up not responding...). I'll probably end up using both in the future, though right now I'm only using MochiKit. I think this architecture is pretty cool (and useful/necessary in SAM's case).

Instead of adding a thick client to SAM (which has some drawbacks since SAM will happily run from the command line on Windows, Linux and Macs) which would increase the download by a significant amount as well as increase complexity, and in some cases (headless machines) not even work, I'm doing something a little different.

This first developmental release (0.30) starts up a prototyped webserver (hacked out using WebStack) when passed in the "--ajax" parameter. It will also start up a browser and point it to "localhost:8080/index". The initial interface allows you to choose the components to run and see the results.

This is all pure python right now (well, AJAX is compliments of MochiKit (javascript)), but I could envision other applications using this sort of architecture. For example, anything that one stores on a thumb drive could probably be adapted to use this sort of architecture. That way even though you run on different machines (Mac, Windows or Linux) you can still access the data in the same way (provided you have python installed on those machines (the only one where this is probably an issue is Windows and it's trivial to use py2exe in those cases and create a small ~2Meg exe)) as well as remotely if needed.

For people who want to see a simple example of JSON/Ajax/MochiKit in action feel free to download the .30 release. This architecture should be really straightforward for people who want to understand and look under the hood of the server side of AJAX.

I'm not suggesting using this server side code in any production environment. Basically I took WebStack and created a simple endpoint that dispatches everything through it (I'm pretty sure this is the wrong way to do it, but it took about 150 lines for the whole server, which includes the ajax endpoints).

I need to look at Twisted (a good reason to buy the book), or possibly stripped down versions of Django or TurboGears. I want to keep everything in pure python and as small as possible, but I'd like to re-use others code/best practices when possible. The end goal is the .40 release(SAM is adopting a even is stable odd is development numbering scheme).

Hopefully one will be able to have SAM servers that can discover others (possibly through pyzeroconf) and allow IT folks to control multiple instances from a single browser. Anyway, as you can tell, I think this could turn out to be pretty cool. Feel free to provide feedback (if you think I'm just jumping on the AJAX bandwagon) or if you like the mini-local-client-server-ajax-gui architecture.