From b0b09d752d9add8c667c0447896b5b9c13a80f22 Mon Sep 17 00:00:00 2001 From: Ivan Tyagov <ivan@nexedi.com> Date: Tue, 20 Nov 2012 10:57:06 +0200 Subject: [PATCH] Do not allow a thread reference overlap with any traversable Web Section or root module ID. --- .../WebSection_createNewDiscussionThread.xml | 9 +++++++-- bt5/erp5_discussion/bt/revision | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml index 515ac29dc9..40a9153f24 100644 --- a/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml +++ b/bt5/erp5_discussion/SkinTemplateItem/portal_skins/erp5_discussion/WebSection_createNewDiscussionThread.xml @@ -81,8 +81,13 @@ multimembership_criterion_base_category_list = context.getMultimembershipCriteri reference = context.Base_generateReferenceFromString(title)\n \n existing_document = context.getDocumentValue(reference)\n -if existing_document is not None:\n - # if there are other document which reference duplicates just add some random part\n +existing_web_section_list = portal.portal_catalog(id=reference, portal_type=[\'Web Site\', \'Web Section\'])\n +existing_module_list = portal.portal_catalog(id=reference, parent_uid=portal.getUid())\n +if existing_document is not None \\\n + or len(existing_web_section_list) \\\n + or len(existing_module_list):\n + # if there are other document or any tarversal objects (module, web section)\n + # which ID or reference duplicates just add some random part\n # so we can distinguish)\n reference = \'%s-%s\' %(context.Base_generateRandomString(), reference)\n \n diff --git a/bt5/erp5_discussion/bt/revision b/bt5/erp5_discussion/bt/revision index 6d3e9dc78d..8306ec157b 100644 --- a/bt5/erp5_discussion/bt/revision +++ b/bt5/erp5_discussion/bt/revision @@ -1 +1 @@ -129 \ No newline at end of file +130 \ No newline at end of file -- 2.30.9