From e126ce8533c9437208aacc7e8587c96532c83aa7 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Wed, 12 May 2010 13:37:50 +0000 Subject: [PATCH] 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 --- product/ERP5/Document/Document.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py index 012365fc82..9c7ffb464b 100644 --- a/product/ERP5/Document/Document.py +++ b/product/ERP5/Document/Document.py @@ -967,11 +967,11 @@ class Document(PermanentURLMixIn, XMLObject, UrlMixIn, CachedConvertableMixin, S Based on the document content, find out as many properties as needed. returns properties which should be set on the document """ - if getattr(self, 'hasData', None) is not None and not self.hasData(): - # if document is empty, we will not find anything in its content - return dict() - if not self.hasBaseData(): - raise NotConvertedError + # accesss data through convert + mime, content = self.convert(None) + if not content: + # if document is empty, we will not find anything in its content + return {} method = self._getTypeBasedMethod('getPropertyDictFromContent', fallback_script_id='Document_getPropertyDictFromContent') return method() -- 2.30.9