Hi Massimo,

Please consider to change sqlhtml.py 's StringWidget to:

class StringWidget(object): # I'll explain later
  @staticmethod
  def widget(field,value,**attributes):
    ....
    default_attributes=dict(
            _type='text',
            _id=id,
            _class=field.type,
            _name=field.name,
            value=str(value),
            requires=field.requires,
            )
    default_attributes.update(attributes)
    return INPUT(**default_attributes)

This way, developers can customize the widget's _title or _size ...
etc. much easily, like this:
  db.Field('addr','string',length=128,
    widget=lambda f,v: StringWidget.widget(
      f,v,_size=128,_title='Input your detail addr please'))

Without the suggested improvement, currently I have to subclass a new
StringWidget to do that.


Another minor suggestion is to change StringWidget's base class to
"object" (as I did in above example). This way the StringWidget will
become a "new-style" python class. Then when people need to subclass
it, they can use the python builtin super(...) function for more
convenience.

These modifications are backward compatible.

Same suggestions apply to TextWidget, BooleanWidget, OptionsWidget,
MultipleOptionsWidget, PasswordWidget, UploadWidget.

Please consider it. Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to