[Zope3-Users] correct display of Text field in a view

Adam Groszer agroszer at gmail.com
Wed Mar 14 05:13:06 EDT 2007


Hello Ivan,

I don't think that you'll need IMultiLineText and MultiLineText.
That's why IText and Text are there for. You'll have to register the
widget for IText or use it directly in your view with
CustomWidgetFactory.

In fact it's a good question why Z3 doesn't provide such a widget for
Text. The current widget is just Displaywidget which eats the
newlines.

BTW: "<br \>" should be "<br />"

Wednesday, March 14, 2007, 9:30:19 AM, you wrote:

> Darryl, Frank,

> thank you your answers, but finally i keep the widget solution
> instead of TextAreaWidget i inherited my widget from DisplayWidget, and
> of course used your replace solution.

> class IMultiLineText(IText):
>     """this field will be used for the comment because of the correct 
> display of html tags"""
>   
>     pass

> class MultiLineText(Text):
>     """the field implementation"""
>     implements(IMultiLineText)
>    
> class MultiLineTextWidget(DisplayWidget):
>     """the widget to display the description"""

>     def __call__(self):
>         return super(MultiLineTextWidget, 
> self).__call__().replace("\n","<br \>")



> Darryl Cousins wrote:
>> On Fri, 2007-03-09 at 10:06 +0100, Ivan Horvath wrote:
>>   
>>> - modify the description widget data with 
>>> PlainTextToHTMLRenderer.render(), but then in the browser i can see
>>> only 
>>> encoded chars instead of <br> 
>>>     
>>
>> Hi,
>>
>> As for Frank's suggestion try:
>>
>> <p tal:content="structure view/description" />
>>
>> when rendering the text2html content. That should allow the html tags
>> through.
>>
>> Regards,
>> Darryl
>>
>>
>>
>>   




-- 
Best regards,
 Adam                            mailto:agroszer at gmail.com



More information about the Zope3-users mailing list