Commit e126ce85 authored by Nicolas Delaby's avatar Nicolas Delaby

Do not assert that data comes from getData,

let convert method return the expected data (for TextDocument, data comes from
text_content).
Also, convert method only should raise NotConvertedError if needed


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35218 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6257ef4b
...@@ -967,11 +967,11 @@ class Document(PermanentURLMixIn, XMLObject, UrlMixIn, CachedConvertableMixin, S ...@@ -967,11 +967,11 @@ class Document(PermanentURLMixIn, XMLObject, UrlMixIn, CachedConvertableMixin, S
Based on the document content, find out as many properties as needed. Based on the document content, find out as many properties as needed.
returns properties which should be set on the document returns properties which should be set on the document
""" """
if getattr(self, 'hasData', None) is not None and not self.hasData(): # accesss data through convert
mime, content = self.convert(None)
if not content:
# if document is empty, we will not find anything in its content # if document is empty, we will not find anything in its content
return dict() return {}
if not self.hasBaseData():
raise NotConvertedError
method = self._getTypeBasedMethod('getPropertyDictFromContent', method = self._getTypeBasedMethod('getPropertyDictFromContent',
fallback_script_id='Document_getPropertyDictFromContent') fallback_script_id='Document_getPropertyDictFromContent')
return method() return method()
......
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