[Erp5-report] r39119 ivan - in /erp5/trunk/bt5/erp5_forge: SkinTemplateItem/portal_skins/er...
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Oct 14 10:45:22 CEST 2010
Author: ivan
Date: Thu Oct 14 10:45:21 2010
New Revision: 39119
URL: http://svn.erp5.org?rev=39119&view=rev
Log:
Separate script to get duplicating selection names and improve it.
Added:
erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_getDuplicateSelectionNameDict.xml
Modified:
erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_checkDuplicateSelectionName.xml
erp5/trunk/bt5/erp5_forge/bt/revision
Modified: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_checkDuplicateSelectionName.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_checkDuplicateSelectionName.xml?rev=39119&r1=39118&r2=39119&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_checkDuplicateSelectionName.xml [utf8] (original)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_checkDuplicateSelectionName.xml [utf8] Thu Oct 14 10:45:21 2010
@@ -2,10 +2,7 @@
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
- <tuple>
- <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
- <tuple/>
- </tuple>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
@@ -55,21 +52,11 @@
<key> <string>_body</string> </key>
<value> <string encoding="cdata"><![CDATA[
-"""Print all listbox that uses the same selection name.\n
"""\n
-skins_tool = context.portal_skins\n
-selection_name_dict = dict()\n
-\n
-for field_path, field in skins_tool.ZopeFind(\n
- skins_tool, obj_metatypes=[\'ProxyField\', \'ListBox\'], search_sub=1):\n
- if field.meta_type == \'ProxyField\':\n
- if field.getRecursiveTemplateField().meta_type != \'ListBox\' \\\n
- or field.is_delegated(\'selection_name\'):\n
- continue\n
- \n
- selection_name_dict.setdefault(\n
- field.get_value(\'selection_name\'), []).append(field_path)\n
+ Print all listbox that uses the same selection name.\n
+"""\n
\n
+selection_name_dict = context.SkinsTool_getDuplicateSelectionNameDict()\n
for selection_name, field_list in selection_name_dict.items():\n
if len(field_list) > 1:\n
print repr(selection_name), \'\\n\\t\', \'\\n\\t\'.join(field_list)\n
@@ -116,12 +103,8 @@ return printed\n
<string>_print</string>
<string>_getattr_</string>
<string>context</string>
- <string>skins_tool</string>
- <string>dict</string>
<string>selection_name_dict</string>
<string>_getiter_</string>
- <string>field_path</string>
- <string>field</string>
<string>selection_name</string>
<string>field_list</string>
<string>len</string>
Added: erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_getDuplicateSelectionNameDict.xml
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_getDuplicateSelectionNameDict.xml?rev=39119&view=auto
==============================================================================
--- erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_getDuplicateSelectionNameDict.xml (added)
+++ erp5/trunk/bt5/erp5_forge/SkinTemplateItem/portal_skins/erp5_toolbox/SkinsTool_getDuplicateSelectionNameDict.xml [utf8] Thu Oct 14 10:45:21 2010
@@ -0,0 +1,157 @@
+<?xml version="1.0"?>
+<ZopeData>
+ <record id="1" aka="AAAAAAAAAAE=">
+ <pickle>
+ <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
+ </pickle>
+ <pickle>
+ <dictionary>
+ <item>
+ <key> <string>Script_magic</string> </key>
+ <value> <int>3</int> </value>
+ </item>
+ <item>
+ <key> <string>_bind_names</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>_asgns</string> </key>
+ <value>
+ <dictionary>
+ <item>
+ <key> <string>name_container</string> </key>
+ <value> <string>container</string> </value>
+ </item>
+ <item>
+ <key> <string>name_context</string> </key>
+ <value> <string>context</string> </value>
+ </item>
+ <item>
+ <key> <string>name_m_self</string> </key>
+ <value> <string>script</string> </value>
+ </item>
+ <item>
+ <key> <string>name_subpath</string> </key>
+ <value> <string>traverse_subpath</string> </value>
+ </item>
+ </dictionary>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>_body</string> </key>
+ <value> <string>"""\n
+ Get all listbox fields that uses the same selection name.\n
+"""\n
+\n
+skins_tool = context.portal_skins\n
+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
+ if field.meta_type == \'ProxyField\':\n
+ original_field = field.getRecursiveTemplateField()\n
+ if original_field is not None and \\\n
+ (original_field.meta_type != \'ListBox\' \\\n
+ or field.is_delegated(\'selection_name\')\n
+ or original_field.get_tales(\'selection_name\')!=\'\'):\n
+ continue\n
+ elif field.meta_type == \'ListBox\':\n
+ if field.get_tales(\'selection_name\')!=\'\':\n
+ continue\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
+\n
+ selection_name_dict.setdefault(\n
+ field.get_value(\'selection_name\'), []).append(field_path)\n
+\n
+return selection_name_dict\n
+</string> </value>
+ </item>
+ <item>
+ <key> <string>_code</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>_params</string> </key>
+ <value> <string></string> </value>
+ </item>
+ <item>
+ <key> <string>errors</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_code</string> </key>
+ <value>
+ <object>
+ <klass>
+ <global name="FuncCode" module="Shared.DC.Scripts.Signature"/>
+ </klass>
+ <tuple/>
+ <state>
+ <dictionary>
+ <item>
+ <key> <string>co_argcount</string> </key>
+ <value> <int>0</int> </value>
+ </item>
+ <item>
+ <key> <string>co_varnames</string> </key>
+ <value>
+ <tuple>
+ <string>_getattr_</string>
+ <string>context</string>
+ <string>skins_tool</string>
+ <string>selection_name_dict</string>
+ <string>ok_to_share_selection_form_list</string>
+ <string>_getiter_</string>
+ <string>field_path</string>
+ <string>field</string>
+ <string>form</string>
+ <string>original_field</string>
+ <string>None</string>
+ </tuple>
+ </value>
+ </item>
+ </dictionary>
+ </state>
+ </object>
+ </value>
+ </item>
+ <item>
+ <key> <string>func_defaults</string> </key>
+ <value>
+ <none/>
+ </value>
+ </item>
+ <item>
+ <key> <string>id</string> </key>
+ <value> <string>SkinsTool_getDuplicateSelectionNameDict</string> </value>
+ </item>
+ <item>
+ <key> <string>warnings</string> </key>
+ <value>
+ <tuple/>
+ </value>
+ </item>
+ </dictionary>
+ </pickle>
+ </record>
+</ZopeData>
Modified: erp5/trunk/bt5/erp5_forge/bt/revision
URL: http://svn.erp5.org/erp5/trunk/bt5/erp5_forge/bt/revision?rev=39119&r1=39118&r2=39119&view=diff
==============================================================================
--- erp5/trunk/bt5/erp5_forge/bt/revision [utf8] (original)
+++ erp5/trunk/bt5/erp5_forge/bt/revision [utf8] Thu Oct 14 10:45:21 2010
@@ -1 +1 @@
-615
\ No newline at end of file
+616
\ No newline at end of file
More information about the Erp5-report
mailing list