#2241 new defect

exception when trying to attach file to trac ticket

Reported by: zooko Owned by:
Priority: normal Milestone: undecided
Component: dev-infrastructure Version: 1.10.0
Keywords: trac Cc:
Launchpad Bug:

Description

ambimorph got this error, and I found this exception in the trac.log:

2014-06-04 18:33:49,589 Trac[main] ERROR: Internal Server Error: 
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request
    dispatcher.dispatch(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/web/main.py", line 214, in dispatch
    resp = chosen_handler.process_request(req)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/attachment.py", line 512, in process_request
    data = self._do_save(req, attachment)
  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1-py2.7.egg/trac/attachment.py", line 733, in _do_save
    attachment):
  File "build/bdist.linux-x86_64/egg/tracspamfilter/adapters.py", line 139, in validate_attachment
    FilterSystem(self.env).test(req, author, changes)
  File "build/bdist.linux-x86_64/egg/tracspamfilter/filtersystem.py", line 277, in test
    score, reasons, [req.path_info, req.args]).insert()
  File "build/bdist.linux-x86_64/egg/tracspamfilter/model.py", line 139, in insert
    self._request_to_xml(self.request)))
  File "build/bdist.linux-x86_64/egg/tracspamfilter/model.py", line 297, in _request_to_xml
    return ElementTree.tostring(root)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1127, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 821, in write
    serialize(write, self._root, encoding, qnames, namespaces)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 940, in _serialize_xml
    _serialize_xml(write, e, encoding, qnames, None)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 933, in _serialize_xml
    v = _escape_attrib(v, encoding)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1093, in _escape_attrib
    _raise_serialization_error(text)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1053, in _raise_serialization_error
    "cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize None (type NoneType)

She reports that she then tried the exact same operation again -- attaching the exact same file to the exact same ticket, and this time it worked.

[timeline?from=Jun+4%2C+2014&daysback=1&authors=&changeset=on&milestone=on&ticket=on&ticket_details=on&wiki=on&update=Update The Timeline] shows her successful attachment operation.

Doubtless this is related to #1581, although note that we upgraded to trac v1.0.1 since #1581 last reared its ugly head.

Change History (3)

comment:1 Changed at 2014-06-04T21:07:14Z by warner

Does that traceback suggest that the tracspamfilter was trying to convert the attached file into.. XML? Or maybe the metadata about the attachment request? What on earth does it use XML for?

comment:2 Changed at 2014-06-12T15:27:06Z by daira

The tracspamfilter was enabled after the last reported instance of #1581, which suggests that this is a different issue.

Last edited at 2014-06-12T15:45:48Z by daira (previous) (diff)

comment:3 Changed at 2014-08-05T05:15:50Z by zooko

Could be related to #2270.

Note: See TracTickets for help on using tickets.