Tim Black wrote:
> Khalid EZZARAOUI wrote:
>   
>> in fact i use python2.5 and turbogears-1.0.4beta1
>> and this work without using "tostring()" :
>>
>> def makePlaceLink(place):
>>      link = Element('a', href='/placeManager/place/%d' % place.id)
>>      link.text = place
>>      return link
>>
>> def index(self):
>>      the_place_fields = [
>>              ('Place', makePlaceLink)
>>              ('DeltaT', makeDeltaT),
>>              ....
>>   
>>     
> Ok, I was using ToscaWidgets' DataGrid, and it doesn't work there.  I 
> tried it in a TurboGears DataGrid and it works.  So, the problem is that 
> ToscaWidgets' DataGrid doesn't handle elementtree Elements properly.  I 
> tried comparing the code in the two datagrid.py files, but wasn't able 
> to see where the important difference is.  Perhaps someone can find the 
> necessary change and submit a patch to Alberto.
>   
I think what's needed in toscawidgets/core.py Widget is something like 
the following, taken from turbogears/widgets/base.py Widget.display():

        # logic for managing the params attribute
        for param in self.__class__.params:
            if param in params:
                param_value = params[param]
                if callable(param_value):
                    param_value = param_value()
            else:
                # if the param hasn't been overridden (passed as a keyword
                # argument inside **params) put the corresponding instance
                # value inside params.
                param_value = getattr(self, param, None)
            # make sure we don't pass a reference to mutables
            params[param] = copy_if_mutable(param_value)

But I can't figure out where to put that sort of logic in core.py.  
Maybe in Widget.update_params(), which almost seems to be handling the case.

Tim Black

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

Reply via email to