Commit 806cedba authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

support portal_type and classification for ContributionTool_newContentFromUrl.

code cleanup for ContributionTool_newContent.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@29174 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 6a370141
...@@ -61,14 +61,12 @@ ...@@ -61,14 +61,12 @@
\n \n
translateString = context.Base_translateString\n translateString = context.Base_translateString\n
\n \n
\n
# ingest file (asynchronously)\n # ingest file (asynchronously)\n
if portal_type:\n if not portal_type:\n
doc = context.portal_contributions.newContent(file=file,\n portal_type = None\n
doc = context.portal_contributions.newContent(file=file,\n
portal_type=portal_type,\n portal_type=portal_type,\n
classification=classification)\n classification=classification)\n
else:\n
doc = context.portal_contributions.newContent(file=file, classification=classification)\n
\n \n
msg = translateString("${portal_type} created successfully.",\n msg = translateString("${portal_type} created successfully.",\n
mapping = {\'portal_type\':doc.getPortalType()})\n mapping = {\'portal_type\':doc.getPortalType()})\n
...@@ -118,6 +116,7 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m ...@@ -118,6 +116,7 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>translateString</string> <string>translateString</string>
<string>None</string>
<string>doc</string> <string>doc</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
......
...@@ -60,14 +60,13 @@ ...@@ -60,14 +60,13 @@
"""\n """\n
\n \n
translateString = context.Base_translateString\n translateString = context.Base_translateString\n
portal_type = kw.get(\'portal_type\', None)\n
\n \n
# ingest file (asynchronously)\n # ingest file (asynchronously)\n
if portal_type:\n if not portal_type:\n
doc = context.portal_contributions.newContentFromURL(url = url,\n portal_type = None\n
portal_type = portal_type)\n doc = context.portal_contributions.newContentFromURL(url = url,\n
else:\n portal_type=portal_type,\n
doc = context.portal_contributions.newContentFromURL(url=url)\n classification=classification)\n
\n \n
msg = translateString("URL contributed successfully.")\n msg = translateString("URL contributed successfully.")\n
return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':msg})\n return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':msg})\n
...@@ -81,7 +80,7 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m ...@@ -81,7 +80,7 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>dialog_id=None, form_id=None, url=None, **kw</string> </value> <value> <string>dialog_id=None, form_id=None, url=None, portal_type=None, classification=None, **kw</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -101,7 +100,7 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m ...@@ -101,7 +100,7 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m
<dictionary> <dictionary>
<item> <item>
<key> <string>co_argcount</string> </key> <key> <string>co_argcount</string> </key>
<value> <int>3</int> </value> <value> <int>5</int> </value>
</item> </item>
<item> <item>
<key> <string>co_varnames</string> </key> <key> <string>co_varnames</string> </key>
...@@ -110,12 +109,13 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m ...@@ -110,12 +109,13 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m
<string>dialog_id</string> <string>dialog_id</string>
<string>form_id</string> <string>form_id</string>
<string>url</string> <string>url</string>
<string>portal_type</string>
<string>classification</string>
<string>kw</string> <string>kw</string>
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>translateString</string> <string>translateString</string>
<string>None</string> <string>None</string>
<string>portal_type</string>
<string>doc</string> <string>doc</string>
<string>msg</string> <string>msg</string>
</tuple> </tuple>
...@@ -133,6 +133,8 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m ...@@ -133,6 +133,8 @@ return context.Base_redirect(\'view\', keep_items = {\'portal_status_message\':m
<none/> <none/>
<none/> <none/>
<none/> <none/>
<none/>
<none/>
</tuple> </tuple>
</value> </value>
</item> </item>
......
51 52
\ No newline at end of file \ No newline at end of file
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