Commit 29e2e842 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Fix document conversion not being performed when data is set directly.

This fixes test_base_convertable_behaviour_with_successive_updates from
testDmsWithPreConversion.TestDocumentWithPreConversion which was previously
working properly with files only.

Also, split up the test for deleting data as it's not implemented yet.
parent 344fdad9
...@@ -58,6 +58,7 @@ ...@@ -58,6 +58,7 @@
<value> <value>
<list> <list>
<string>_setFile</string> <string>_setFile</string>
<string>_setData</string>
</list> </list>
</value> </value>
</item> </item>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<value> <value>
<list> <list>
<string>_setFile</string> <string>_setFile</string>
<string>_setData</string>
<string>_setTextContent</string> <string>_setTextContent</string>
</list> </list>
</value> </value>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
<value> <value>
<list> <list>
<string>_setFile</string> <string>_setFile</string>
<string>_setData</string>
</list> </list>
</value> </value>
</item> </item>
......
2011-11-11 arnaud.fontaine
* Fix document conversion not being performed when data is set directly.
2011-10-24 Kazuhiko 2011-10-24 Kazuhiko
* make telephone field searchable in person_module view and organisation_module view. * make telephone field searchable in person_module view and organisation_module view.
......
1000 1001
\ No newline at end of file \ No newline at end of file
...@@ -245,7 +245,7 @@ class CachedConvertableMixin: ...@@ -245,7 +245,7 @@ class CachedConvertableMixin:
"""Update md5 checksum from the original file """Update md5 checksum from the original file
""" """
data = self.getData() data = self.getData()
if data is not None: if data not in (None, ''):
if isinstance(data, Pdata): if isinstance(data, Pdata):
self._setContentMd5(hashPdataObject(aq_base(data))) self._setContentMd5(hashPdataObject(aq_base(data)))
else: else:
......
...@@ -2377,6 +2377,26 @@ return 1 ...@@ -2377,6 +2377,26 @@ return 1
self.assertNotEquals(previous_md5, document.getContentMd5()) self.assertNotEquals(previous_md5, document.getContentMd5())
self.assertEquals(document.getExternalProcessingState(), 'converted') self.assertEquals(document.getExternalProcessingState(), 'converted')
# Currently, 'empty' state in processing_status_workflow is only set
# when creating a document and before uploading any file. Once the
# document has been uploaded and then the content is cleared, the
# document state stays at 'converting' state as empty base_data is
# not handled
@expectedFailure
def test_base_convertable_behaviour_when_deleted(self):
"""
Check that deleting the content of a previously uploaded document
actually clear base_data and md5 and check that the document goes
back to empty state
"""
# create a document
upload_file = makeFileUpload('TEST-en-002.doc')
kw = dict(file=upload_file, synchronous_metadata_discovery=True)
document = self.portal.Base_contribute(**kw)
self.stepTic()
self.assertTrue(document.hasBaseData())
self.assertTrue(document.hasContentMd5())
# Delete content: base_data must be deleted # Delete content: base_data must be deleted
document.edit(data=None) document.edit(data=None)
self.stepTic() self.stepTic()
......
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