Ticket #4503: twisted-words-domish-handle-xmlns-names-with-spaces.patch

File twisted-words-domish-handle-xmlns-names-with-spaces.patch, 972 bytes (added by michich, 4 years ago)

domish: handle spaces in xmlns IRIs

  • twisted/words/xish/domish.py

    domish: handle spaces in xmlns IRIs
    
    In the "name" received from pyexpat only the last space delimits
    the namespace from the tag/attr name.
    Any previous spaces are part of the namespace IRI.
    
    Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
    
     
    759759 
    760760    def _onStartElement(self, name, attrs): 
    761761        # Generate a qname tuple from the provided name 
    762         qname = name.split(" ") 
     762        qname = name.rsplit(" ", 1) 
    763763        if len(qname) == 1: 
    764764            qname = ('', name) 
    765765 
    766766        # Process attributes 
    767767        for k, v in attrs.items(): 
    768768            if k.find(" ") != -1: 
    769                 aqname = k.split(" ") 
     769                aqname = k.rsplit(" ", 1) 
    770770                attrs[(aqname[0], aqname[1])] = v 
    771771                del attrs[k] 
    772772