Skip to content

Commit 0178a12

Browse files
committed
issue2551323: Remove XHTML support
Deprecated in Roundup 2.3.0, invalid in 2.4.0, and removing supporting code in 2.5.0.
1 parent b20ec93 commit 0178a12

File tree

3 files changed

+5
-45
lines changed

3 files changed

+5
-45
lines changed

CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ Fixed:
8989
- issue2551376: Fix tracebacks in item templates (Ralf Schlatterbeck)
9090
- issue2551396: Use of os.path.stat.ST_MTIME in python 3.13 crashes
9191
roundup on windows. Replaced with equivalent stat.ST_MTIME.
92+
- issue2551323: remove functions used for XHTML template
93+
support. XHTML was deprecated in Roundup 2.3.0 and an invalid value
94+
in 2.4.0.
9295

9396
Features:
9497

roundup/cgi/templating.py

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -628,44 +628,20 @@ def html4_cgi_escape_attrs(**attrs):
628628
for k, v in sorted(attrs.items())])
629629

630630

631-
def xhtml_cgi_escape_attrs(**attrs):
632-
''' Boolean attributes like 'disabled', 'required'
633-
are represented with a value that is the same as
634-
the attribute name.. E.G.
635-
<input required="required" ...> not <input required ..>
636-
The latter is html4 or 5. Recognize booleans by:
637-
value is None
638-
Code can use None to indicate a pure boolean.
639-
'''
640-
return ' '.join(['%s="%s"' % (k, html_escape(str(v), True))
641-
if v is not None else '%s="%s"' % (k, k)
642-
for k, v in sorted(attrs.items())])
643-
644-
645631
def input_html4(**attrs):
646632
"""Generate an 'input' (html4) element with given attributes"""
647633
_set_input_default_args(attrs)
648634
return '<input %s>' % html4_cgi_escape_attrs(**attrs)
649635

650636

651-
def input_xhtml(**attrs):
652-
"""Generate an 'input' (xhtml) element with given attributes"""
653-
_set_input_default_args(attrs)
654-
return '<input %s/>' % xhtml_cgi_escape_attrs(**attrs)
655-
656-
657637
class HTMLInputMixin(object):
658638
""" requires a _client property """
659639
def __init__(self):
660640
html_version = 'html4'
661641
if hasattr(self._client.instance.config, 'HTML_VERSION'):
662642
html_version = self._client.instance.config.HTML_VERSION
663-
if html_version == 'xhtml':
664-
self.input = input_xhtml
665-
self.cgi_escape_attrs = xhtml_cgi_escape_attrs
666-
else:
667-
self.input = input_html4
668-
self.cgi_escape_attrs = html4_cgi_escape_attrs
643+
self.input = input_html4
644+
self.cgi_escape_attrs = html4_cgi_escape_attrs
669645
# self._context is used for translations.
670646
# will be initialized by the first call to .gettext()
671647
self._context = None

test/test_templating.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -710,24 +710,6 @@ def test_input_html4(self):
710710
input=input_html4(**attrs)
711711
self.assertEqual(input, '<input class="required" disabled="disabled" size="30" type="text">')
712712

713-
def test_input_xhtml(self):
714-
# boolean attributes are attribute name="attribute name"
715-
# indicate with attr=None or attr="attr"
716-
# e.g. disabled="disabled"
717-
input=input_xhtml(required=None, size=30)
718-
self.assertEqual(input, '<input required="required" size="30" type="text"/>')
719-
720-
input=input_xhtml(required="required", size=30)
721-
self.assertEqual(input, '<input required="required" size="30" type="text"/>')
722-
723-
attrs={"required": None, "class": "required", "size": 30}
724-
input=input_xhtml(**attrs)
725-
self.assertEqual(input, '<input class="required" required="required" size="30" type="text"/>')
726-
727-
attrs={"disabled": "disabled", "class": "required", "size": 30}
728-
input=input_xhtml(**attrs)
729-
self.assertEqual(input, '<input class="required" disabled="disabled" size="30" type="text"/>')
730-
731713

732714
class HTMLPropertyTestClass(unittest.TestCase):
733715
def setUp(self):
@@ -1613,7 +1595,6 @@ def view_check(self):
16131595
def edit_check(self):
16141596
16151597
def input_html4(**attrs):
1616-
def input_xhtml(**attrs):
16171598
16181599
class HTMLInputMixin:
16191600
def __init__(self):

0 commit comments

Comments
 (0)