Commit bba54e07 authored by Nicolas Delaby's avatar Nicolas Delaby

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


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41716 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0b4dcfeb
......@@ -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
......
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