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 @@ ...@@ -69,18 +69,13 @@
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>N_ = context.getPortalObject().Base_translateString\n <value> <string>N_ = context.getPortalObject().Base_translateString\n
allowed_type_list = context.getVisibleAllowedContentTypeList()\n
\n \n
# Add an object of the same type as the container\n if not allowed_type_list:\n
# or if allowed content types is 1 add that type\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
try:\n \n
new_object = context.newContent()\n # newContent will add the first allowed type when we do not specify portal_type=\n
except IndexError:\n new_object = context.newContent()\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
\n \n
return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': N_("Object Created.")})\n return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), keep_items={\'portal_status_message\': N_("Object Created.")})\n
</string> </value> </string> </value>
...@@ -134,8 +129,8 @@ return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), ke ...@@ -134,8 +129,8 @@ return context.ERP5Site_redirect(\'%s/view\' % (new_object.absolute_url(), ), ke
<string>_getattr_</string> <string>_getattr_</string>
<string>context</string> <string>context</string>
<string>N_</string> <string>N_</string>
<string>allowed_type_list</string>
<string>new_object</string> <string>new_object</string>
<string>IndexError</string>
</tuple> </tuple>
</value> </value>
</item> </item>
......
307 308
\ 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