exception when trying to attach file to trac ticket #2241

Open
opened 2014-06-04 18:46:53 +00:00 by zooko · 3 comments

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.

[The Timeline]timeline?from=Jun+4%2C+2014&daysback=1&authors=&changeset=on&milestone=on&ticket=on&ticket_details=on&wiki=on&update=Update 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.

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. [The Timeline]timeline?from=Jun+4%2C+2014&daysback=1&authors=&changeset=on&milestone=on&ticket=on&ticket_details=on&wiki=on&update=Update 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.
zooko added the
dev-infrastructure
normal
defect
1.10.0
labels 2014-06-04 18:46:53 +00:00
zooko added this to the undecided milestone 2014-06-04 18:46:53 +00:00

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?

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?
daira commented 2014-06-12 15:27:06 +00:00
Owner

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

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

Could be related to #2270.

Could be related to #2270.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Reference: tahoe-lafs/trac-2024-07-25#2241
No description provided.