Workin in console :

In [1]: test123 = 'test/test2/test3/'

In [2]: test123
Out[2]: 'test/test2/test3/'

In [3]: for v in test123.split('/'):
   ...:     if v != '':
   ...:         v
   ...:
   ...:
Out[3]: 'test'
Out[3]: 'test2'
Out[3]: 'test3'

In [4]: XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
Out[4]: <gluon.html.XML object at 0x26ec550>

In [5]: print XML(UL(*[ LI(v) for v in test123.split('/') if v != '' ]))
<ul><li>test</li><li>test2</li><li>test3</li></ul>

But in generated view I only get the default option no ul or li...

Thanks

Richard

On Thu, Nov 10, 2011 at 12:01 PM, Richard Vézina <
ml.richard.vez...@gmail.com> wrote:

> Hello Anthony,
>
> I am trying to do something bizzard... I would like to have your advice if
> it's even possible :
>
> represent=lambda value, row: (value!=None and XML(UL(*[ LI(v) for v in
> value.split('/') if v != '' ]))) or 'None'
>
> I would like the default navigator drop box to display html stuff is this
> possible?
>
> Thanks
>
> Richard
>
>
> On Thu, Nov 10, 2011 at 8:07 AM, Anthony <abasta...@gmail.com> wrote:
>
>> On Thursday, November 10, 2011 7:58:57 AM UTC-5, peter wrote:
>>>
>>> I have a couple of problems with 'text' fields in databases. I want to
>>> be able to use a WYSIWIG editor, so I have set up ckeditor using the
>>> instructions here
>>>
>>> http://www.web2pyslices.com/**slices/take_slice/18<http://www.web2pyslices.com/slices/take_slice/18>
>>>
>>> This works fine, but there is no toolbar appearing with the editor.
>>> How does one get the basic toolbar to appear?
>>>
>>
>> You have to set the CKEditor options -- see it's documentation:
>> http://ckeditor.com/
>>
>>
>>>
>>> If I succeed in getting this working and can embolden text etc. How do
>>> I convert the text to html that reflects this emboldening?
>>>
>>
>> You won't be converting text to HTML -- CKEditor itself generates HTML,
>> which is what will get saved in the associated text field in the DB. The
>> trick is how to get the HTML to display properly when you pull it from the
>> DB and include it in the view. By default, web2py will escape the HTML, so
>> it won't display as intended. To avoid that, use the XML() helper -- in the
>> view, {{=XML(your_html_content)}}. Though this is dangerous if you are
>> allowing users to enter the HTML because they can insert malicious
>> Javascript. In that case, use {{=XML(your_html_content, sanitize=True)}},
>> though that will limit the allowed HTML tags and attributes. See
>> http://web2py.com/book/default/chapter/05#XML.
>>
>> Anthony
>>
>
>

Reply via email to