Commit 3aaec205 authored by Nicolas Delaby's avatar Nicolas Delaby

parameter handling of Image conversion changed, so follow new implemenation

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35271 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1b1974e2
...@@ -1563,6 +1563,14 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p> ...@@ -1563,6 +1563,14 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p>
transaction.commit() transaction.commit()
self.tic() self.tic()
preference_tool = getToolByName(self.portal, 'portal_preferences')
image_size = preference_tool.getPreferredThumbnailImageHeight(),\
preference_tool.getPreferredThumbnailImageWidth()
convert_kw = {'format': 'png',
'quality': 75,
'display': 'thumbnail',
'resolution': None}
class ThreadWrappedConverter(Thread): class ThreadWrappedConverter(Thread):
"""Use this class to run different convertion """Use this class to run different convertion
inside distinct Thread. inside distinct Thread.
...@@ -1578,12 +1586,14 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p> ...@@ -1578,12 +1586,14 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p>
def run(self): def run(self):
for frame in self.frame_list: for frame in self.frame_list:
# Use publish method to dispatch conversion among # Use publish method to dispatch conversion among
# all available Zserver threads. # all available ZServer threads.
response = self.publish_method('%s/index_html?format=png'\ convert_kw['frame'] = frame
'&display=thumbnail&quality:int=75&resolution='\ response = self.publish_method(self.document_path,
'&frame=%s' % (self.document_path, frame), basic=self.credential,
self.credential) extra=convert_kw)
assert response.getHeader('content-type') == 'image/png'
assert response.getHeader('content-type') == 'image/png', \
response.getHeader('content-type')
assert response.getStatus() == httplib.OK assert response.getStatus() == httplib.OK
transaction.commit() transaction.commit()
...@@ -1607,18 +1617,15 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p> ...@@ -1607,18 +1617,15 @@ style=3D'color:black'>05D65812<o:p></o:p></span></p>
transaction.commit() transaction.commit()
self.tic() self.tic()
preference_tool = getToolByName(self.portal, 'portal_preferences')
image_size = preference_tool.getPreferredThumbnailImageHeight(),\
preference_tool.getPreferredThumbnailImageWidth()
convert_kw = {'format': 'png', convert_kw = {'format': 'png',
'display': 'thumbnail',
'quality': 75, 'quality': 75,
'image_size': image_size, 'image_size': image_size,
'resolution': ''} 'resolution': None}
result_list = [] result_list = []
for i in xrange(pages_number): for i in xrange(pages_number):
# all conversions should succeeded and stored in cache storage # all conversions should succeeded and stored in cache storage
convert_kw['frame'] = str(i) convert_kw['frame'] = i
if not document.hasConversion(**convert_kw): if not document.hasConversion(**convert_kw):
result_list.append(i) result_list.append(i)
self.assertEquals(result_list, []) self.assertEquals(result_list, [])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment