Mercurial > p > roundup > code
changeset 8318:9369e0958312
issue2551323: Remove XHTML support
Deprecated in Roundup 2.3.0, invalid in 2.4.0, and removing supporting
code in 2.5.0.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Sun, 11 May 2025 20:26:42 -0400 |
| parents | 4455cd036c25 |
| children | 5e6ff4e9cacb |
| files | CHANGES.txt roundup/cgi/templating.py test/test_templating.py |
| diffstat | 3 files changed, 5 insertions(+), 45 deletions(-) [+] |
line wrap: on
line diff
--- a/CHANGES.txt Sun May 11 20:22:45 2025 -0400 +++ b/CHANGES.txt Sun May 11 20:26:42 2025 -0400 @@ -89,6 +89,9 @@ - issue2551376: Fix tracebacks in item templates (Ralf Schlatterbeck) - issue2551396: Use of os.path.stat.ST_MTIME in python 3.13 crashes roundup on windows. Replaced with equivalent stat.ST_MTIME. +- issue2551323: remove functions used for XHTML template + support. XHTML was deprecated in Roundup 2.3.0 and an invalid value + in 2.4.0. Features:
--- a/roundup/cgi/templating.py Sun May 11 20:22:45 2025 -0400 +++ b/roundup/cgi/templating.py Sun May 11 20:26:42 2025 -0400 @@ -628,44 +628,20 @@ for k, v in sorted(attrs.items())]) -def xhtml_cgi_escape_attrs(**attrs): - ''' Boolean attributes like 'disabled', 'required' - are represented with a value that is the same as - the attribute name.. E.G. - <input required="required" ...> not <input required ..> - The latter is html4 or 5. Recognize booleans by: - value is None - Code can use None to indicate a pure boolean. - ''' - return ' '.join(['%s="%s"' % (k, html_escape(str(v), True)) - if v is not None else '%s="%s"' % (k, k) - for k, v in sorted(attrs.items())]) - - def input_html4(**attrs): """Generate an 'input' (html4) element with given attributes""" _set_input_default_args(attrs) return '<input %s>' % html4_cgi_escape_attrs(**attrs) -def input_xhtml(**attrs): - """Generate an 'input' (xhtml) element with given attributes""" - _set_input_default_args(attrs) - return '<input %s/>' % xhtml_cgi_escape_attrs(**attrs) - - class HTMLInputMixin(object): """ requires a _client property """ def __init__(self): 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 + self.input = input_html4 + self.cgi_escape_attrs = html4_cgi_escape_attrs # self._context is used for translations. # will be initialized by the first call to .gettext() self._context = None
--- a/test/test_templating.py Sun May 11 20:22:45 2025 -0400 +++ b/test/test_templating.py Sun May 11 20:26:42 2025 -0400 @@ -710,24 +710,6 @@ input=input_html4(**attrs) self.assertEqual(input, '<input class="required" disabled="disabled" size="30" type="text">') - def test_input_xhtml(self): - # boolean attributes are attribute name="attribute name" - # indicate with attr=None or attr="attr" - # e.g. disabled="disabled" - input=input_xhtml(required=None, size=30) - self.assertEqual(input, '<input required="required" size="30" type="text"/>') - - input=input_xhtml(required="required", size=30) - self.assertEqual(input, '<input required="required" size="30" type="text"/>') - - attrs={"required": None, "class": "required", "size": 30} - input=input_xhtml(**attrs) - self.assertEqual(input, '<input class="required" required="required" size="30" type="text"/>') - - attrs={"disabled": "disabled", "class": "required", "size": 30} - input=input_xhtml(**attrs) - self.assertEqual(input, '<input class="required" disabled="disabled" size="30" type="text"/>') - class HTMLPropertyTestClass(unittest.TestCase): def setUp(self): @@ -1613,7 +1595,6 @@ def edit_check(self): def input_html4(**attrs): -def input_xhtml(**attrs): class HTMLInputMixin: def __init__(self):
