- From: Steven Miale <stevenmiale@hotmail.com>
- Date: Fri, 08 Oct 2004 22:03:09 +0000
- To: public-web-plugins@w3.org
In July of 1994, I distributed a small web browser written in the Python language called "Dancer" which had a form of configurable plug-in: http://www.python.org/search/hypermail/python-1994q3/0070.html Dancer was meant to be modularized, unlike Mosaic. Looking at 'dancer' gives you some idea of what this means. There are two types of modules that can be loaded: agents, which retrieve URLs, and viewers, which display or process them. For instance, import basicurl loads in the file 'agents/basicurl.py'. You are not forced to use this; you could write your own if you thought it would be better or faster. The same goes for the viewers: import audio import pict import mpeg import postscript import whtml Each module is only required to register itself with the dispatcher module; it must tell it what kind of data it is looking for. For example, 'viewers/audio.py' consists of: import posix from dispatcher import * def Play(url, name, (file, header)): posix.system('/usr/openwin/bin/audiotool ' + file + ' &') RegisterExtension('au', Play) RegisterContentType('audio/basic', Play) The last two lines register the MIME-style content type (when retrieving files via HTTP) and the extension (when the content type is unavailable.) Anything with a content type of "audio/basic" or an extension of "au" is sent to Play. The callback takes the unfiltered URL, the filtered name (originally the URL, but can be modified by modules which filter the data rather than display it, like an uncompress module), and a tuple consisting of the filename and the header (an RFC822 object; see rfc822.py). Thoughts? Steve
Received on Friday, 8 October 2004 22:43:38 UTC