web2py_ckeditor4 error in view

18 views
Skip to first unread message

Maurice Waka

unread,
Apr 8, 2020, 3:10:49 AM4/8/20
to web2py-users
I followed this example which worked perfectly well a day ago.

I used the LOAD helper for the views.

But when trying to view data from the db I keep getting this error:

Traceback (most recent call last):
 
File "/home/maurice/web2py/gluon/restricted.py", line 219, in restricted
   
exec(ccode, environment)
 
File "/home/maurice/web2py/applications/riv/views/que_chat/timedscroll6.load", line 60, in <module>
    font
-size: 18px;
 
File "/home/maurice/web2py/gluon/html.py", line 627, in __init__
    text
= sanitizer.sanitize(text, permitted_tags, allowed_attributes)
 
File "/home/maurice/web2py/gluon/packages/yatl/yatl/sanitizer.py", line 236, in sanitize
    allowed_attributes
=allowed_attributes).strip(text, escape)
 
File "/home/maurice/web2py/gluon/packages/yatl/yatl/sanitizer.py", line 187, in strip
   
self.feed(rawstring)
 
File "/usr/lib/python3.6/html/parser.py", line 111, in feed
   
self.goahead(0)
 
File "/usr/lib/python3.6/html/parser.py", line 163, in goahead
   
self.handle_data(unescape(rawdata[i:j]))
 
File "/home/maurice/web2py/gluon/packages/yatl/yatl/sanitizer.py", line 88, in handle_data
   
if data and not self.in_disallowed[-1]:
IndexError: list index out of range

Having done some ground work I noted that these tags:
</li> <li>
<p></p>
</ol> </ol>
among others were the problem.
The text is posted well to the db but retrieving to view is the issue.
I have used 
model:

ckeditor = CKEditor(db)
ckeditor
.settings.url_upload = URL(request.app, 'plugin_ckeditor', 'upload', extension='html')
ckeditor
.settings.url_browse = URL(request.app, 'plugin_ckeditor', 'browse', extension='html')

ckeditor
.define_tables()
track_changes
(True)

then

ckeditor = CKEditor(db)

ckeditor.define_tables()
track_changes(True)


view:
{{=XML(post.answer)}}

as well as 
{{=XML(post.answer, sanitize=True)}}

and

{{=XML(post.answer, sanitize=False)}}


How do i solve this error?

Reply all
Reply to author
Forward
0 new messages