Re: Make htmlfill only apply to certain named forms
A Monkey <[email protected]> Sun, 31 Jan 2010 17:23:16 -0500
| Newsgroups | gmane.comp.python.formencode |
|---|---|
| Message-ID | <[email protected]> |
Hi Adam, On Sun, Jan 31, 2010 at 3:17 PM, Adam Batkin <[email protected]> wrote: > > I have a use case where it would be good if htmlfill could operate only on a > particular named form (<form name="foo">) and leave any other forms alone. > > For example, if there were two forms on a page, one for logging in (with a > username field) and one for creating a new user (also with a username > field), the filling-in would only touch the one specified. This use case is not uncommon, and the usual advice for handling it is "use unique field names" (as I'm sure you've heard :). That's not so great, I don't think. I'd be happy to have something like this around. > Attached is a proposed patch that adds this ability. My initial testing has > found that it works pretty well. Can you add some tests for the change into your patch? htmlfill.render is a pretty busy place and could use the testing attention. > It adds an optional argument to htmlfill.render(): form_name > > If a form_name is not passed, htmlfill should act exactly the same as > before. If a form_name IS passed however, htmlfill will only ever touch the > named form (plus any unnamed forms, though I'm not sure if this is ahttps://mail.google.com/mail/?shva=1#label/formencode/1268619c75a51425 good > idea). I think your instincts are on target with regard to unnamed forms. Probably it's best to ignore them if a named form has been specified explicitly. Adding another optional parameter is the standard mechanism for adding configurable behaviour to htmlfill.render, but that parameter list is getting awfully long. Does anyone have any ideas about breaking rendering up a little bit? Thanks, Matthew ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com