创建review request,除了查看代码diff进行评论这个主要功能外,还可以添加日志、图片等文件,并对这些附件评论。
测试时发现添加普通日志之类文件正常,但添加图片时出现错误。提示你可能是个bug或服务器配置问题。
查看日志显示的是“
The _imaging C module is not installed”。
google了一下,得知是默认的PIL模块对Image在windows下的支持有问题。
在网上找到了另一个可用的版本:PIL-1.1.7,针对不同python平台提供了32/64位的版本。
Internal Server Error: /reviews/api/review-requests/37/file-attachments/
Traceback (most recent call last):
File "F:\CodeReview\Python27\lib\site-packages\django-1.4.3-py2.7.egg\django\core\handlers\base.py", line 188, in get_response
response = middleware_method(request, response)
File "F:\CodeReview\Python27\lib\site-packages\django-1.4.3-py2.7.egg\django\middleware\http.py", line 14, in process_response
response['Content-Length'] = str(len(response.content))
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\webapi\core.py", line 281, in _get_content
content = adapter.encode(self.api_data, request=self.request)
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\webapi\core.py", line 88, in encode
return super(JSONEncoderAdapter, self).encode(o)
File "F:\CodeReview\Python27\lib\json\encoder.py", line 201, in encode
chunks = self.iterencode(o, _one_shot=True)
File "F:\CodeReview\Python27\lib\json\encoder.py", line 264, in iterencode
return _iterencode(o, 0)
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\webapi\core.py", line 96, in default
result = self.encoder.encode(o, *self.encode_args, **self.encode_kwargs)
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\webapi\core.py", line 261, in encode
result = encoder.encode(*args, **kwargs)
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\webapi\encoders.py", line 48, in encode
return resource.serialize_object(o, *args, **kwargs)
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\webapi\resources.py", line 906, in serialize_object
value = getattr(obj, field)
File "F:\CodeReview\Python27\lib\site-packages\reviewboard-1.7.2-py2.7.egg\reviewboard\attachments\models.py", line 39, in thumbnail
return self.mimetype_handler.get_thumbnail()
File "F:\CodeReview\Python27\lib\site-packages\reviewboard-1.7.2-py2.7.egg\reviewboard\attachments\mimetypes.py", line 195, in get_thumbnail
% (thumbnail(self.attachment.file),
File "F:\CodeReview\Python27\lib\site-packages\djblets-0.7.8-py2.7.egg\djblets\util\templatetags\djblets_images.py", line 118, in thumbnail
image.thumbnail([x, y], Image.ANTIALIAS)
File "F:\CodeReview\Python27\lib\site-packages\PIL\Image.py", line 1559, in thumbnail
self.load()
File "F:\CodeReview\Python27\lib\site-packages\PIL\ImageFile.py", line 164, in load
self.load_prepare()
File "F:\CodeReview\Python27\lib\site-packages\PIL\ImageFile.py", line 231, in load_prepare
self.im = Image.core.new(self.mode, self.size)
File "F:\CodeReview\Python27\lib\site-packages\PIL\Image.py", line 37, in __getattr__
raise ImportError("The _imaging C module is not installed")
ImportError: The _imaging C module is not installed