Commit 887ab27f authored by Jérome Perrin's avatar Jérome Perrin

take into account hidden content types in Folder_create; if there is no...

take into account hidden content types in Folder_create; if there is no visible and allowed content type nothing is created.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11643 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 368bfb12
......@@ -69,18 +69,13 @@
<item>
<key> <string>_body</string> </key>
<value> <string>N_ = context.getPortalObject().Base_translateString\n
allowed_type_list = context.getVisibleAllowedContentTypeList()\n
\n
# Add an object of the same type as the container\n
# or if allowed content types is 1 add that type\n
try:\n
new_object = context.newContent()\n
except IndexError:\n
# return only a portal_status_message if the IndexError is raised because\n
# there are no elemnts in context.allowedContentTypes()\n
if not context.allowedContentTypes():\n
return context.ERP5Site_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n
else:\n
raise\n
if not allowed_type_list:\n
return context.ERP5Site_redirect(\'%s/view\' % (context.absolute_url(), ), keep_items={\'portal_status_message\': N_("You are not allowed to add new content in this context.")})\n
\n
# newContent will add the first allowed type when we do not specify portal_type=\n
new_object = context.newContent()\n
\n
return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': N_("Object Created.")})\n
</string> </value>
......@@ -134,8 +129,8 @@ return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), ke
<string>_getattr_</string>
<string>context</string>
<string>N_</string>
<string>allowed_type_list</string>
<string>new_object</string>
<string>IndexError</string>
</tuple>
</value>
</item>
......
307
\ No newline at end of file
308
\ 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