Jens Tröger schrieb am 06.04.2015 um 23:56:
I am trying to understand the process_children() function. If in my extension is have
def execute(self, context, self_node, input_node, output_parent): self.process_children(context, output_parent)
then processing works just fine (although I haven't done anything with the output here). However, using
def execute(self, context, self_node, input_node, output_parent): x = self.process_children(context, output_parent=None) output_parent.append(x)
crashes:
x = self.process_children(context, output_parent=None) File "xsltext.pxi", line 111, in lxml.etree.XSLTExtension.process_children (src/lxml/lxml.etree.c:164356) File "readonlytree.pxi", line 550, in lxml.etree._nonRoNodeOf (src/lxml/lxml.etree.c:78766) TypeError: invalid argument type <class 'NoneType'>
although I had assumed the two to be synonymous. I ask because I want to inject my own node and dangle children off of my own node like this:
p = lxml.etree.Element("p") p.attrib["style"] = "..." output_parent.append(p) self.process_children(context, p)
but that, too, fails.
Latest master has a bug fix, but now I'm getting random failures of the newly added test (which didn't work before at all), every so many runs. It's currently unclear to me why it's failing, so I'd be happy if you could investigate this a bit. https://github.com/lxml/lxml/blob/06ae415eda3ebd6eef09d5fbe52b130f2a51c81e/s... The symptom is that the text content that the test code constructs is sometimes incomplete and contains only "This is * text" instead of "This is *-arbitrary-* text". Here for example: https://travis-ci.org/lxml/lxml/jobs/58890120 Stefan