nevow
nevow copied to clipboard
Flattening an attribute value fails to quote it satisfactorily
Adjusting the value in the attribute tests to include a double quote in the rendered value.
--- a/nevow/test/test_newflat.py
+++ b/nevow/test/test_newflat.py
@@ -478,7 +478,7 @@ class FlattenTests(TestCase, FlattenMixin):
which was returned by L{IRenderable.render} is replaced with the result
of the named renderer on the L{IRenderable} which returned the L{Tag}.
"""
- result = "quux"
+ result = 'qu"ux'
renders = []
request = object()
tag = div(foo=invisible(render="bar"))
Yields this test failure:
twisted.trial.unittest.FailTest: '<div foo="qu"ux"></div>' != '<div foo="quux"></div>'
nevow.test.test_newflat.FlattenTests.test_renderAttributeNestedInAttributeValue
Resilient HTML parsers are able to parse this output but the results are mangled in the vein of <div foo="qu" ux="">
. XHTML parsers (such as in use by Athena) refuse to parse this output altogether.
This issue became apparent when trying to render a value with double-quotes into the value
attribute of an input
element.
Brief investigation indicates that the inAttribute
flag is not propagated (either from WovenContext
or from nested _flatten
calls) in the render-directive case, preventing the inAttribute
case of escapedData
from being used.
Just out of curiosity - can this be reproduced in Python 2? If not then the problem might be in one of the changes introduced by porting to Python 3.
@wthie Sorry I should have mentioned that this was discovered and reproduced on Python 2.
No problem, there was another flattener problem recently on the twisted mailing list, flattening still seems to be a tricky thing. I only have very simple use cases for flattening but will look into the problem when starting the chunking of the Python3 port.