[ZPT] Re: zpt macro question. Widgets?

Raphael Ritz r.ritz at biologie.hu-berlin.de
Fri Mar 26 06:41:41 EST 2004



Dorneles Treméa wrote:
> Hi Michael,
> 
> 
>>I have been trying to trace down the code that performs the work in line
>>2...  I know it is calling the script widget, passing the name of the
>>field returned in line one, in view mode, and it wants the label placed
>>in the widget... But where is the 'widget' script... I have looked in
>>plone_scripts, and in the product root in the ZMI, but I can't locate
>>it, and it doesn't seem to be on the local FS...
>>
>>Now, I am using Archetypes, and there is a subdirectory in the
>>skins/archetypes directory with pt files for the different types of
>>fields, but, widget would have to be a script, correct?
> 
> 
> Not necessarily, it can be an object method... :-)
> 
> Tip: inside Archetypes directory, run something like:
> 
> grep 'def widget(' .
> 
> BaseObject.py: def widget(self, field_name, mode="view", field=None,
> **kwargs):
> 
> 

and as follow-up:
the

return renderer.render(field_name, mode, widget, self, field=field,
                                **kwargs)

call sets up the current context (to be used in the template) as:
         context.setLocal('here', instance)
         context.setLocal('fieldName', field_name)
         context.setLocal('accessor', accessor)
         context.setLocal('widget', widget)
         context.setLocal('field', field)
         context.setLocal('mode', mode)

Raphael

>>Can anyone help me out here?
> 
> 
> HTH... regards,
> 





More information about the ZPT mailing list