SWAMI and pyward

Fri 18 March 2005 by pj Tagged as software www
So the other day I went looking for something to manage .htaccess files via a CGI. They're a mild pain to edit manually, so I figured someone had run into this problem before. I was right - but everyone wanted $25ish for their solution. So I decided it couldn't be that hard and set off to 'scratch my own itch' as most programmers do.

Managing an entire .htaccess seemed a bit big to bite off at once (since I didn't remember that much about the format), so I decided to get htpasswd/htgroup-file managment out of the way first. A simple little webapp emerged, named SWAMI (Simple Web Authorizaion Management Interface).

As I was writing it, I decided it would be cool to make it nice and RESTful, because one of the side effects of doing so is that it makes sure I don't forget anything. So I reorganized the code some and made the URI space and actions RESTful. As I was doing so, I found it annoying to rewrite a bunch of the same if-then statements over and over, so I decided to refactor the code into a framework. I've done this before in a different context, and I spent some time looking at Tarawa, so I soon had something simple and flexible. This framework then got moved into its own library, which I called pyward (Python Web App RESTful Dispatcher).

So now I've got this RESTful framework which at the moment deals with being a CGI but could easily be bolted onto the side of an HTTPServer class.