Kevin Dangoor wrote:
>
> I am, of course, not a big fan of pushing responsibility to the user.
> In some ways, I'd be more interested in extending FormEncode to be
> able to do getattrs than to push the responsibility to the user. That
> would allow the user to keep the behavior of any properties they have
> and whatnot without having to write a custom dictionify function.
>
> Because of properties and things, atribute access is really just like
> a superset of dictionary access (which is what DicitonaryWrapper took
> advantage of).
>

Personally I think Widgets should always work with a dict since this
fits better with the nested paradigm also.

We can avoid patching FE and instead we can add to tg.util a ObjToDict
wrapper (you get the point) that wraps an object so that we can access
it like a dict, then in CompoundWidget we just need this:

    def adjust_value(self, value, **params):
        if not isinstance(value, dict):
             value = ObjToDict(value)
        return super(CompoundWidget, self).adjust_value(value,
**params)

this is the best solution that should keep everyone happy, me for the
widget code (only use dicts), users and Kevin. ;-)

I really prefer wrapping an object to be like a dict that doing the
contrary.

Ciao
Michele


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk
-~----------~----~----~----~------~----~------~--~---

Reply via email to