hforge / itools

Python library with tons of features
http://www.hforge.org/itools
GNU General Public License v3.0
22 stars 12 forks source link

Fix cases where FormError return a XMLParser not accepted by STL #71

Closed Nabellaleen closed 7 years ago

Nabellaleen commented 7 years ago

Fix this TB when an AutoField is submitted and encounter mandatory field errors

Traceback (most recent call last):
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/web/router.py", line 280, in handle_request
    context.site_root.after_traverse(context)
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/ikaaro/root.py", line 253, in after_traverse
    context.entity = self.get_skin(context).template(body)
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/ikaaro/skins.py", line 439, in template
    data = stl(handler, namespace, prefix=prefix, mode='html')
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 311, in stl
    return stream_to_str_as_html(stream, encoding)
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/html/xhtml.py", line 118, in stream_to_str_as_html
    stream = set_content_type(stream, content_type)
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/html/xhtml.py", line 81, in set_content_type
    for event in stream:
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 375, in process
    for event, value, kk in stream:
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 269, in substitute
    for x in value:
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 406, in process
    encoding, skip_events):
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 375, in process
    for event, value, kk in stream:
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 269, in substitute
    for x in value:
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 431, in process
    stack, re_stack, encoding)
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 359, in process_start_tag
    value, n = substitute_attribute(value, stack, repeat, encoding)
  File "/home/florian/.local/share/virtualenvs/076/lib/python2.7/site-packages/itools/stl/stl.py", line 217, in substitute_attribute
    return value.gettext().encode(encoding), 1
AttributeError: 'itools.xml.parser.XMLParser' object has no attribute 'encode'