Mercurial > p > roundup > code
diff roundup/cgi/templating.py @ 6057:b6e56d096c58
Revert boolean attribute rendering
Revert (part of) the change that optimizes rendering of boolean
attributes in HTML-4. This breaks rendering of non-boolean attributes
(like name="name").
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Fri, 17 Jan 2020 10:54:03 +0100 |
| parents | b4b5b7afacd9 |
| children | 8fbcaac944e7 |
line wrap: on
line diff
--- a/roundup/cgi/templating.py Wed Jan 15 21:04:17 2020 -0500 +++ b/roundup/cgi/templating.py Fri Jan 17 10:54:03 2020 +0100 @@ -443,7 +443,7 @@ <input required ..> not <input required="required" ...> The latter is xhtml. Recognize booleans by: value is None - value is the same as the atribute + value is the same as the attribute Code can use either method to indicate a pure boolean. ''' return ' '.join(['%s="%s"'%(k,html_escape(str(v), True)) @@ -480,12 +480,11 @@ html_version = 'html4' if hasattr(self._client.instance.config, 'HTML_VERSION'): html_version = self._client.instance.config.HTML_VERSION - if html_version == 'xhtml': - self.input = input_xhtml - self.cgi_escape_attrs=xhtml_cgi_escape_attrs - else: - self.input = input_html4 - self.cgi_escape_attrs=html4_cgi_escape_attrs + # HTML-4 allows attributes like required=required, so for now + # revert the change that optimizes this and breaks rendering of + # non-boolean attributes (like name="name"). + self.input = input_xhtml + self.cgi_escape_attrs=xhtml_cgi_escape_attrs # self._context is used for translations. # will be initialized by the first call to .gettext() self._context = None
