HTML form pre-populating functionality or hints on building my own

Ian Bicking ianb at colorstudy.com
Thu Apr 17 02:22:04 EDT 2003


On Wed, 2003-04-16 at 21:39, Scott Chapman wrote:
> Hi!
> I'm wanting to find (or make) a module that will take a HTML file, locate the 
> input-related form tags (<INPUT, <TEXTAREA, <SELECT, <OPTION) and modify them 
> by putting in values from a dictionary (i.e. pre-populate the form). I want a 
> module that is implemented 100% in python and does _not_ use any special tags 
> to do this (such as webware, albatross, spyce, etc.)

Huh... for some reason it's never occured to me to do it this way, I
always emit the tags with the values filled in, rather than parsing the
HTML.  An interesting idea.

Of course someone may correct me, but I haven't seen anything like this
for Python, and I at least try to keep an eye out for such stuff.

> If I should build this myself, I'd like to know, would be better to use a text 
> parsing module such as Plex to do the parsing?  I've never used any text 
> parsing tool in Unix so it'll be all new to me.  I want to keep it simple as 
> a standalone module to only populate form elements from a variable 
> dictionary, so I'm thinking a parser might be overkill? If you think a parser 
> would be the way to go on this, which one would you recommend? (Simple and 
> quick is best IMHO).

You'll probably want to use htmllib, which is a standard Python module.

  Ian







More information about the Python-list mailing list