[Erp5-report] r41716 nicolas - /erp5/trunk/products/ERP5/Tool/ContributionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Dec 23 16:12:27 CET 2010
Author: nicolas
Date: Thu Dec 23 16:12:26 2010
New Revision: 41716
URL: http://svn.erp5.org?rev=41716&view=rev
Log:
If portal_type and container are explicitely passed by user.
We can take a shortcut.
portal_contribution.newContent(portal_type, container) will be an
alias of container.newContent(portal_type) with starting of Metadata Discovery
process.
Done by JPS
Modified:
erp5/trunk/products/ERP5/Tool/ContributionTool.py
Modified: erp5/trunk/products/ERP5/Tool/ContributionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/ContributionTool.py?rev=41716&r1=41715&r2=41716&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/ContributionTool.py [utf8] Thu Dec 23 16:12:26 2010
@@ -191,6 +191,19 @@ class ContributionTool(BaseTool):
# filename
content_type = self.guessMimeTypeFromFilename(filename)
+ if portal_type and container is not None:
+ # Simplify things here and return a document immediately
+ # XXX Nicolas: This will break support of WebDAV
+ # if _setObject is not called
+ document = container.newContent(id=document_id, **kw)
+ if discover_metadata:
+ document.activate(after_path_and_method_id=(document.getPath(),
+ ('convertToBaseFormat', 'Document_tryToConvertToBaseFormat')))\
+ .discoverMetadata(filename=filename,
+ user_login=user_login,
+ input_parameter_dict=input_parameter_dict)
+ return document
+
# If the portal_type was provided, we can go faster
if portal_type and container is None:
# We know the portal_type, let us find the default module
More information about the Erp5-report
mailing list