What version are you running?
ReviewBoard 1.7.16
What's the URL of the page containing the problem?
POST /reviews/api/review-requests/231/reviews/784/file-attachment-comments/
GET /reviews/api/review-requests/231/reviews/784/file-attachment-comments/9/?api_format=json
What steps will reproduce the problem?
1. Create a review request and fill in enough to publish it.
2. Update -> Add File. Attach a text file, not an image.
3. Publish the review request.
4. Click "Add Comment" on the attachment.
5. Write a comment and press "Save".
At this point, the POST to /reviews/api/review-requests/231/reviews/784/file-attachment-comments/ gets a 500 error from the server. However this error is not indicated in the web UI, and it does not move on to indicating you have a pending review.
6. Reload the page. It now indicates you have a pending review.
7. Click "Edit Review". It shows the comment on the file attachment, so it did save after all! However, it also causes an invisible 500 error for GET /reviews/api/review-requests/231/reviews/784/file-attachment-comments/9/?api_format=json
8. Press "Save" or "Publish Review". This causes another 500 error on GET /reviews/api/review-requests/231/reviews/784/file-attachment-comments/9/?api_format=json and the web UI brings up "A server error occured." The review cannot be published because of this.
9. Discarding the review and writing a new one without a comment on a text file attachment is successful.
10. Uploading an image instead of a text file, and adding review comments to that is successful.
What is the expected output? What do you see instead?
I expect to be able to comment on uploaded text files just as well as uploaded image files. Instead I get 500 errors.
What operating system are you using? What browser?
Linux, Firefox 25.0.1
Please provide any additional information below.
Excerpt from the POST request traceback:
Request Method: POST
Request URL: .../reviews/api/review-requests/231/reviews/784/file-attachment-comments/
Django Version: 1.4.9
Python Version: 2.6.8
Python Path: ['.../reviewboard/conf', '/usr/lib64/python2.6/site-packages/pysvn-1.7.4-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/recaptcha_client-1.0.6-py2.6.egg', '/usr/lib/python2.6/site-packages/pytz-2013d-py2.6.egg', '/usr/lib/python2.6/site-packages/python_memcached-1.53-py2.6.egg', '/usr/lib/python2.6/site-packages/python_dateutil-1.5-py2.6.egg', '/usr/lib/python2.6/site-packages/Pygments-1.6-py2.6.egg', '/usr/lib/python2.6/site-packages/paramiko-1.11.0-py2.6.egg', '/usr/lib/python2.6/site-packages/mimeparse-0.1.3-py2.6.egg', '/usr/lib/python2.6/site-packages/Markdown-2.3.1-py2.6.egg', '/usr/lib/python2.6/site-packages/docutils-0.11-py2.6.egg', '/usr/lib/python2.6/site-packages/django_pipeline-1.2.24-py2.6.egg', '/usr/lib/python2.6/site-packages/django_evolution-0.6.9-py2.6.egg', '/usr/lib/python2.6/site-packages/pycrypto-2.6-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/PIL-1.1.6-py2.6-linux-x86_64.egg', '/usr/lib/python2.6/site-packages/feedparser-5.1.3-py2.6.egg', '/usr/lib/python2.6/site-packages/ReviewBoard-1.7.16-py2.6.egg', '/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg', '/usr/lib/python2.6/site-packages/Django-1.4.9-py2.6.egg', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info']
Traceback:
File "/usr/lib/python2.6/site-packages/Django-1.4.9-py2.6.egg/django/core/handlers/base.py" in get_response
188. response = middleware_method(request, response)
File "/usr/lib/python2.6/site-packages/Django-1.4.9-py2.6.egg/django/middleware/http.py" in process_response
14. response['Content-Length'] = str(len(response.content))
File "/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg/djblets/webapi/core.py" in _get_content
285. content = adapter.encode(self.api_data, request=self.request)
File "/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg/djblets/webapi/core.py" in encode
88. return super(JSONEncoderAdapter, self).encode(o)
File "/usr/lib64/python2.6/json/encoder.py" in encode
367. chunks = list(self.iterencode(o))
File "/usr/lib64/python2.6/json/encoder.py" in _iterencode
309. for chunk in self._iterencode_dict(o, markers):
File "/usr/lib64/python2.6/json/encoder.py" in _iterencode_dict
275. for chunk in self._iterencode(value, markers):
File "/usr/lib64/python2.6/json/encoder.py" in _iterencode
317. for chunk in self._iterencode_default(o, markers):
File "/usr/lib64/python2.6/json/encoder.py" in _iterencode_default
323. newobj = self.default(o)
File "/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg/djblets/webapi/core.py" in default
96. result = self.encoder.encode(o, *self.encode_args, **self.encode_kwargs)
File "/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg/djblets/webapi/core.py" in encode
265. result = encoder.encode(*args, **kwargs)
File "/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg/djblets/webapi/encoders.py" in encode
48. return resource.serialize_object(o, *args, **kwargs)
File "/usr/lib/python2.6/site-packages/Djblets-0.7.22-py2.6.egg/djblets/webapi/resources.py" in serialize_object
954. value = serialize_func(obj, request=request)
File "/usr/lib/python2.6/site-packages/ReviewBoard-1.7.16-py2.6.egg/reviewboard/webapi/resources.py" in serialize_thumbnail_html_field
5433. return obj.thumbnail
File "/usr/lib/python2.6/site-packages/ReviewBoard-1.7.16-py2.6.egg/reviewboard/reviews/models.py" in thumbnail
1591. return self.file_attachment.review_ui.get_comment_thumbnail(self)
Exception Type: AttributeError at /reviews/api/review-requests/231/reviews/784/file-attachment-comments/
Exception Value: 'NoneType' object has no attribute 'get_comment_thumbnail'
POST:
file_attachment_id = u'51'
text = u'test'
issue_opened = u'false'
api_format = u'json'
Excerpt from the GET request traceback:
Request Method: GET
Request URL: .../api/review-requests/224/reviews/782/file-attachment-comments/8/?api_format=json
Django Version: 1.4.9
Exception Type: AttributeError
Exception Value: 'NoneType' object has no attribute 'get_comment_thumbnail'
Exception Location: /usr/lib/python2.6/site-packages/ReviewBoard-1.7.16-py2.6.egg/reviewboard/reviews/models.py in thumbnail, line 1591
Request information
GET
Variable Value
api_format u'json'