[Web-SIG] Fun with WSGI -- commenting middleware.
Titus Brown
titus at caltech.edu
Tue Feb 1 19:23:29 CET 2005
-> >I sat down today to hack out a simple commenting system for HTML
-> >articles, and ended up using WSGI to implement a pipe-style solution.
-> >
-> >You can see the results at
-> >
-> > http://www.idyll.org/~t/articles.cgi/
-> >
-> >This CGI script serves HTML files from a directory hierarchy. Anyone
-> >can attach a comment to any HTML file served by the script.
->
-> Spiffy. It would be neat to plug this into a WSGI application that
-> served as a proxy (redisplaying pages fetched from another location).
-> Then you could point it at the Python documentation and get that
-> php.net-like commenting that people are always asking for; it would
-> probably be good to make the commenting more granular, but it's
-> interesting to be able to develop the different parts so separately.
I thought about this a bit more. I like the proxy idea (and will
implement it next time I have the urge to do some light coding). For
the python docs, though, wouldn't it be better to just host the files
on the same machine?
I will probably develop a simple Quixote application to wrap the
commenting code, too; having all this in CGI will get annoying,
if I do anything more complex than what I'm doing now.
-> Actually, I was just going to convert this silly little web-based image
-> viewer I have to WSGI, and with this I could get a free commenting
-> system. Hmm...
The back-end is pretty lousy -- it's just a pickled dictionary of
'Comment' classes -- but that's modular, of course. I'll spruce
up the commenting middleware itself & document that, and then make
it directly available via DARCS.
I'd be interested in people's opinions on how to format the entries &
safeguard against XSS hacks. Right now I'm just pushing the exact
HTML they wrote onto the pages, which strikes me as a Bad Idea.
cheers,
--titus
More information about the Web-SIG
mailing list