From 6af566f8719ac6e4f21f46cfe2c2ba7660f25949 Mon Sep 17 00:00:00 2001 From: Mame Coumba Sall <mame@nexedi.com> Date: Thu, 10 Apr 2014 15:19:12 +0000 Subject: [PATCH] Modified to avoid too many functions or groups set when contributing a document. --- .../Document_getPropertyDictFromUserLogin.xml | 17 +++++++++++++---- bt5/erp5_ingestion/bt/revision | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromUserLogin.xml b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromUserLogin.xml index 8fcd484f13..7e721b2d2b 100644 --- a/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromUserLogin.xml +++ b/bt5/erp5_ingestion/SkinTemplateItem/portal_skins/erp5_ingestion/Document_getPropertyDictFromUserLogin.xml @@ -56,11 +56,20 @@ User would be usually the current user, but sometimes the name has to be given e if e.g. the doc is contributed by email, and the script is run by zope user.\n """\n assignment_dict = context.ERP5Site_getPersonAssignmentDict(user_name=user_name)\n +group_list = assignment_dict[\'group_list\']\n \n -# XXX: make list of properties configurable through preferences\n -return {\'group_list\': assignment_dict[\'group_list\'],\n - \'site_list\': assignment_dict[\'site_list\'],\n - \'function_list\': assignment_dict[\'function_list\']}\n +group_level_dict = {}\n +for group in group_list:\n + group_level = len(group.split("/"))\n + group_level_dict[group] = group_level\n +\n +\n +#Get the highest levels groups of the assignments\n +##if group_list = [\'nexedi\', \'nexedi/hq\', \'nexedi/jp\'] returns [\'nexedi\']\n +##if group_list = [\'nexedi/hq\', \'nexedi/jp\'] returns [\'nexedi/hq\', \'nexedi/jp\']\n +highest_level_group_value = min(group_level_dict.itervalues())\n +highest_level_groups = [k for k in group_level_dict if group_level_dict[k] == highest_level_group_value]\n +return {\'group_list\': highest_level_groups}\n </string> </value> </item> <item> diff --git a/bt5/erp5_ingestion/bt/revision b/bt5/erp5_ingestion/bt/revision index c663e4d093..2d73b5e3ba 100644 --- a/bt5/erp5_ingestion/bt/revision +++ b/bt5/erp5_ingestion/bt/revision @@ -1 +1 @@ -151 \ No newline at end of file +152 \ No newline at end of file -- 2.30.9