Ian Bicking: the old part of his blog

Full templating

I'm actually very reluctant to add something like this -- that's the kind of complexity that htmlfill is specifically meant to avoid, because I've gone down that path before and it didn't work well. But the form building you are thinking of could be implemented separately -- this is some of what formgen is meant to provide. You can't quite do this now, but something like this should be possible at some point:

from formgen import *
class CCField(FormTableLayout):
    layout = [['cc_name'], 
              ['cc_number', 'cc_type', 'cc_expiration', '=MM/YY']] 
        # That last item is a literal instruction
    cc_name = Text(size=40)
    cc_number = Text(size=16)
    cc_type = Select(selections=['Visa', 'Mastercard', 'AmEx'])
    cc_expiration = Text(size=5)

And then that would be a reusable "widget". But it just gets rendered to HTML, and htmlfill fills it in -- nothing more. Another subclass of Layout might even work with a template, but create the <input...> tags and whatnot.

Comment on Re: Further FormEncode Work...
by Ian Bicking