﻿id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc
386,py:match error when XPath selection returns multiple nodes,anonymous,cmlenz,"I'm trying to figure out what is the expected behavior in a py:match 
template when the XPath selection returns more then 1 node. In Genshi 
0.5.1, this wouldn't cause an error in lenient mode but I get an odd 
exception in 0.6. Is this an expected behavior, a regression, or 
undefined? 
I'm testing with this contrived template: 

{{{
<head> 
  <meta py:match=""head/meta"" /> 
  <meta name=""foo"" content=""bar"" /> 
  <meta name=""baz"" content=""boo"" /> 
}}}
... 
I get this back: 


{{{
Traceback (most recent call last): 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/CherryPy-3.1.2-py2.6.egg/cherrypy/_cprequest.py"", line 606, 
in respond 
    cherrypy.response.body = self.handler() 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/CherryPy-3.1.2-py2.6.egg/cherrypy/_cpdispatch.py"", line 25, 
in __call__ 
    return self.callable(*self.args, **self.kwargs) 
  File ""<string>"", line 2, in index 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/spiralup/views.py"", 
line 223, in wrapper 
    *self.filters, **mapping) 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/spiralup/views.py"", 
line 264, in render 
    return stream.render(method=format, doctype=doctype, 
encoding=encoding) 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/core.py"", line 183, in render 
    return encode(generator, method=method, encoding=encoding, 
out=out) 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/output.py"", line 57, in encode 
    return _encode(''.join(list(iterator))) 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/output.py"", line 339, in __call__ 
    for kind, data, pos in stream: 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/output.py"", line 826, in __call__ 
    for kind, data, pos in stream: 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/output.py"", line 670, in __call__ 
    for kind, data, pos in stream: 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/output.py"", line 771, in __call__ 
    for kind, data, pos in chain(stream, [(None, None, None)]): 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/output.py"", line 586, in __call__ 
    for ev in stream: 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/core.py"", line 288, in _ensure 
    for event in stream: 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/template/base.py"", line 605, in 
_include 
    for event in stream: 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/template/markup.py"", line 349, in 
_match 
    test(event, namespaces, ctxt, updateonly=True) 
  File ""/Users/wyuenho/Documents/spiralup/spiralup/lib/python2.6/site- 
packages/Genshi-0.6-py2.6.egg/genshi/path.py"", line 129, in _test 
    pos_queue = deque([(pos, cou, []) for pos, cou in stack[-1]]) 
IndexError: list index out of range 

}}}

This used to just return nothing in 0.5.1 under lenient mode. 
",defect,new,minor,0.9,Template processing,devel,,,wyuenho@…
