[Cubicweb] XHTML delivered as text/html

Florent Cayré florent at secondweb.fr
Tue Jul 21 11:50:46 CEST 2009

Hi all,

I know people working on/ with cubicweb are aware of web standards and have
probably read http://www.hixie.ch/advocacy/xhtml and the whole controversal
discussion around XHTML / HTML 4.

As of today, cubicweb delivers XHTML as text/html to user agents that do not
support application/xml+xhtml content-type (MSIE / Konqueror for example)
and application/xml+xhtml to the others. In that context cubicweb should
implement the W3C guidelines defined here :

In particular, the present common.uilib.simple_sgml_tag function does not
follow the W3C recommendations, and as you may know, leads to buggy
behaviors in some user agents (empty textarea in Opera 10 for example). That
why SecondWeb proposes the following patch :

diff -r 8dc0a52ae6e1 common/uilib.py
--- a/common/uilib.py    Tue Jul 07 13:57:26 2009 +0200
+++ b/common/uilib.py    Tue Jul 21 11:44:37 2009 +0200
@@ -228,7 +228,12 @@
             content = html_escape(unicode(content))
         value += u'>%s</%s>' % (content, tag)
-        value += u'/>'
+        # see http://www.w3.org/TR/xhtml1/#guidelines
+        if tag in set(('base', 'meta', 'link', 'hr', 'br', 'param',
+                       'img', 'area', 'input', 'col')):
+            value += u' />'
+        else:
+            value += u'></%s>' % tag
     return value

 def tooltipize(text, tooltip, url=None):

Would you mind integrate it in cubicweb ?

Florent and Fabrice, for SecondWeb.

Ce message est la propriété de SecondWeb et peut contenir des informations
confidentielles. Si vous n'êtes pas le destinataire désigné, nous vous
remercions de bien vouloir nous en aviser immédiatement et de nous retourner
ce message ou de le détruire, sans faire un quelconque usage de son contenu,
ni le communiquer ou le diffuser, ni en prendre copie, électronique ou non.

This message is the property of SecondWeb and may contain confidential
information. If you are not the designated recipient, please notify us
immediately and return the message to us or destroy it, without making any
use whatsoever of the contents thereof. Furthermore you should not forward
or copy the message by electronic or other means.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cubicweb.org/pipermail/cubicweb/attachments/20090721/9d3be200/attachment-0186.html>

More information about the Cubicweb mailing list