Commit b805970b authored by Jérome Perrin's avatar Jérome Perrin

SkinsTool_getDuplicateSelectionNameDict: do the check for each skin selection

This is mostly to avoid problems with proxy fields not finding their template field in default skin selection
parent 3e16a161
......@@ -61,31 +61,33 @@ selection_name_dict = {}\n
\n
ok_to_share_selection_form_list = [\'Resource_viewInventory\', \'Resource_viewMovementHistory\']\n
\n
for field_path, field in skins_tool.ZopeFind(\n
skins_tool, obj_metatypes=[\'ProxyField\', \'ListBox\'], search_sub=1):\n
form = field.aq_parent\n
# in some rare cases sharing a selection can be done intentional so avoid them\n
if form.getId() in ok_to_share_selection_form_list:\n
continue\n
# if the form looks like a field library, we don\'t care, because it is not used directly.\n
if form.getId().endswith(\'FieldLibrary\'):\n
continue\n
if field.meta_type == \'ProxyField\':\n
try:\n
if field.get_recursive_tales(\'selection_name\') != \'\':\n
for skin_name, skin_path_list in skins_tool.getSkinPaths():\n
skins_tool.changeSkin(skin_name)\n
for skin_folder in skin_path_list.split(\',\'):\n
for field_path, field in skins_tool.ZopeFind(\n
skins_tool[skin_folder], obj_metatypes=[\'ProxyField\', \'ListBox\'], search_sub=1):\n
form = field.aq_parent\n
# in some rare cases sharing a selection can be done intentional so avoid them\n
if form.getId() in ok_to_share_selection_form_list:\n
continue\n
selection_name = field.get_recursive_orig_value(\'selection_name\')\n
except KeyError:\n
continue\n
elif field.meta_type == \'ListBox\':\n
if field.get_tales(\'selection_name\')!=\'\':\n
continue\n
selection_name = field.get_orig_value(\'selection_name\')\n
if selection_name == \'\':\n
continue\n
skin_folder, field_path = field_path.split(\'/\', 1)\n
field_path_map = selection_name_dict.setdefault(selection_name, {})\n
field_path_map.setdefault(field_path, []).append(skin_folder)\n
# if the form looks like a field library, we don\'t care, because it is not used directly.\n
if form.getId().endswith(\'FieldLibrary\'):\n
continue\n
if field.meta_type == \'ProxyField\':\n
try:\n
if field.get_recursive_tales(\'selection_name\') != \'\':\n
continue\n
selection_name = field.get_recursive_orig_value(\'selection_name\')\n
except KeyError:\n
continue\n
elif field.meta_type == \'ListBox\':\n
if field.get_tales(\'selection_name\')!=\'\':\n
continue\n
selection_name = field.get_orig_value(\'selection_name\')\n
if selection_name == \'\':\n
continue\n
field_path_map = selection_name_dict.setdefault(selection_name, {})\n
field_path_map.setdefault(field_path, set()).add(skin_folder)\n
\n
# leave only duplicating ones\n
duplicating_selection_name_dict = {}\n
......
680
\ No newline at end of file
681
\ 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