[Twisted-web] using freeform bind_* instead of subclass TypedInterface

Paul Reznicek maillists at ivsn.com
Mon Jul 18 01:58:35 MDT 2005


Donovan Preston wrote:
> 
> I guess I should learn that attempting to remove a source of FAQs just 
> introduces new FAQs :-)
> 
>> 1. how to omit the automatically generated submit button "Call"
> 
> Thanks for mentioning this. It gave me an idea about a better way to 
> support submit buttons in formless (more like forms does it). However, 
> in the meantime, would it be enough if it said "Submit" instead of 
> "Call"? Or do you want no buttons at all?

Sorry, the name should be a parameter, not all people understand English,
not all time is the action a "call" or a "submit".

>> 2. how to change (or skip) the displayed form name "Two _fields", 
>> resp. the whole frame ?
> 
> The convention is to use camelCase in the method and argument names. If 
> you use camelCase the names should look nice.

But the name of the frame is on this way not translatable. I prefer to
code in English, and using this automatism would push me to code in Czech
for a Czech application, than recode in German, than ...

>> 3. how to get all fields and buttons into one line, resp. one table row ?
> 
> For this, you'd have to customize the skin. It's pretty painful, but it 
> is possible. There's an example of doing it in the examples directory.

I believe, that except the examples in Nevow distribution, everybody NEED
customized skins. Partial effect can be reached with custom css, but not all
necessary tasks. I've tried to do this using ideas and help from Richard Wall
(see my previous message) and the result is more complicated, than render
a form manually.

Nevow is very nice, the livepage technique is great, only the creating and
maintaining of multi-language user interfaces seems to be complicated.
Something like this could be cool in my opinion:

bind_XYZ(self, ctx):
     formType = None      # same effect as skip formType attr. = classical form
# other predefined types can be:
#  'inLineAll':       label:field | label:field ... button(s)
#  'inLineNoLabel':   field | field ... button(s)
#  'twoColunms':      label:field        | label:field
#                     label:field        | button(s)
# ...

     formName = None      # same effect as skip formName attr. = NO form name
#    formName = True      # autogenerate form name (behavior now)
#    formName = _('Testing form 1')     # use this name

     formFrame = None     # same effect as skip formFrame attr. = NO form border
#    formFrame = True     # autogenerate form border (behavior now)
#    formFrame = 'css_class_name'     # modify the default

     submitButton = _('OK')  # use this value (label)
#    submitButton = True     # autogenerate submitButton (behavior now)
#    submitButton = None     # same effect as skip submitButton attr. = NO button

     resetButton = None      # same effect as skip resetButton attr. = NO button
     ...

Also, an easy way to set error messages from application will be nice.
The English message "Please enter a string." is not so user-friendly, like
a (localizable) message i.e. _('Please enter your family name').

Thank you for all the work
Paul




More information about the Twisted-web mailing list