#7 Inserting triple fails when it contains XML special chars

pending
nobody
None
5
2012-12-09
2009-11-30
Anonymous
No

If triple's object contains XML special characters like '<' or '&, inserting of the triple fails. '<' and '&' should probably be encoded to '&lt;' and '&amp;'. I'm using Eemeli Kantola's kpwrapper [1], but it looks like the bug is in Node.py

>>> sc.insert(Triple('foo', 'bar', '&'))
/usr/lib/python2.6/site-packages/kp-0.9.2a1-py2.6.egg/kp/Node.pyc in send(self, payload, pl_type, encoding, confirm, expire_time)
341 parser = make_parser()
342 parser.setContentHandler(icf)
--> 343 parser.parse(StringIO.StringIO(rcvd['bnodes']))
344 if encoding.lower() == 'rdf-m3':
345 return (rcvd["status"], bnodes)

[1] http://public.futurice.com/~ekan/eggs/

Discussion

  • jpvanhal
    jpvanhal
    2009-11-30

    The full code for replicating this problem:

    >>> from kpwrapper import SIBConnection, Triple
    >>> sc = SIBConnection('', 'preconfigured')
    Preconfigured discovery using config from /home/janne/.kprc
    Got params: ('cloudsizzle', ('TCP', ('127.0.0.1', 10010)))
    >>> sc.insert(Triple('foo', 'bar', '&'))
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "build/bdist.linux-x86_64/egg/kpwrapper/__init__.py", line 306, in insert

    File "build/bdist.linux-x86_64/egg/kp/Node.py", line 343, in send
    KeyError: 'bnodes'

     
  • Kirill Krinkin
    Kirill Krinkin
    2012-12-09

    • status: open --> pending