[Kss-devel] BeautifulSoup usage in kss.core

Jeroen Vloothuis jeroen.vloothuis at xs4all.nl
Thu Mar 20 22:18:17 CET 2008


Balazs Ree wrote:
> On Thu, 20 Mar 2008 08:56:47 +0100, Wichert Akkerman wrote: 
>   
>> This also brings me to question the actual necessity of this validation.
>> Plone and most other web tools / frameworks seem to be perfectly fine
>> with not sanitizing or checking the generated HTML. Why would KSS be
>> different?
> We are always open to fixes and improvements on the code, however noone - 
> including you - has suggested to change the current way of html 
> sanitization, unchanged from the initial version of kss. This indicates 
> that the current way of handling works correctly. 
Just because no one complained does not mean it is not broken. The next 
example demonstrates a problem with BeautifulSoup and HTML5 (please note 
that mail will probably split the lines, see 
http://paste.plone.org/20266 for a non broken version):

  >>> from BeautifulSoup import BeautifulSoup

  >>> html = '<p>To make George eat an apple, press 
<kbd><kbd>Shift</kbd>+<kbd>F3</kbd></kbd></p>'
  >>> print BeautifulSoup(html)
  <p>To make George eat an apple, press 
<kbd></kbd><kbd>Shift</kbd>+<kbd>F3</kbd></p>

The example is taken directly from the HTML5 spec:

http://www.w3.org/html/wg/html5/#the-kbd


More information about the Kss-devel mailing list