Commit 4616fe2e authored by Bartek Górny's avatar Bartek Górny

parallel list filed hashing method now trims category name and uses caching

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@10617 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 37478561
...@@ -68,24 +68,35 @@ ...@@ -68,24 +68,35 @@
</item> </item>
<item> <item>
<key> <string>_body</string> </key> <key> <string>_body</string> </key>
<value> <string>sub_field_dict={}\n <value> <string>from Products.ERP5Type.Cache import CachingMethod\n
maximum_list_size=5\n
\n \n
default_sub_field_property_dict[\'field_type\']=\'ListField\'\n def cached_DMSBaseCategoryHash(item_list,value_list,default_sub_field_property_dict,is_right_display):\n
default_sub_field_property_dict[\'size\']=1\n if default_sub_field_property_dict is None:\n
default_sub_field_property_dict={\'field_type\': \'MultiListField\', \'item_list\': [], \'required\': 0, \'value\': [], \'is_right_display\': 0, \'key\': \'default\', \'title\': \'Categories\', \'size\': 5}\n
\n \n
for base_category in item_list:\n sub_field_dict={}\n
maximum_list_size=5\n
\n
default_sub_field_property_dict[\'field_type\']=\'ListField\'\n
default_sub_field_property_dict[\'size\']=1\n
\n
for base_category in item_list:\n
if not sub_field_dict.has_key(base_category):\n if not sub_field_dict.has_key(base_category):\n
basecatobject=context.portal_categories.resolveCategory(base_category)\n basecatobject=context.portal_categories.resolveCategory(base_category)\n
sub_field_property_dict=default_sub_field_property_dict.copy()\n sub_field_property_dict=default_sub_field_property_dict.copy()\n
sub_field_property_dict[\'key\']=base_category\n sub_field_property_dict[\'key\']=base_category\n
sub_field_property_dict[\'title\']=basecatobject.getTranslatedTitle()\n sub_field_property_dict[\'title\']=basecatobject.getTranslatedTitle()\n
sub_field_property_dict[\'item_list\']=basecatobject.getCategoryChildLogicalPathItemList()\n sub_field_property_dict[\'item_list\']=[(context.Base_trimPathName(x,100),y) for x,y in basecatobject.getCategoryChildLogicalPathItemList()]\n
sub_field_property_dict[\'value\']=context.aq_parent.aq_parent.getProperty(base_category)\n sub_field_property_dict[\'value\']=context.aq_parent.aq_parent.getProperty(base_category)\n
\n \n
sub_field_dict[base_category]=sub_field_property_dict\n sub_field_dict[base_category]=sub_field_property_dict\n
\n \n
return sub_field_dict.values()\n return sub_field_dict.values()\n
cached_DMSBaseCategoryHash=CachingMethod(cached_DMSBaseCategoryHash,id=\'DMSParallelListField_DMSBaseCategoryHash\')\n
return cached_DMSBaseCategoryHash(item_list,value_list,default_sub_field_property_dict,is_right_display)\n
\n
\n
# vim: syntax=python shiftwidth=2\n
</string> </value> </string> </value>
</item> </item>
<item> <item>
...@@ -102,7 +113,7 @@ return sub_field_dict.values()\n ...@@ -102,7 +113,7 @@ return sub_field_dict.values()\n
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>item_list, value_list, default_sub_field_property_dict, is_right_display</string> </value> <value> <string>item_list, value_list=(), default_sub_field_property_dict=None, is_right_display=0</string> </value>
</item> </item>
<item> <item>
<key> <string>errors</string> </key> <key> <string>errors</string> </key>
...@@ -132,15 +143,9 @@ return sub_field_dict.values()\n ...@@ -132,15 +143,9 @@ return sub_field_dict.values()\n
<string>value_list</string> <string>value_list</string>
<string>default_sub_field_property_dict</string> <string>default_sub_field_property_dict</string>
<string>is_right_display</string> <string>is_right_display</string>
<string>sub_field_dict</string> <string>Products.ERP5Type.Cache</string>
<string>maximum_list_size</string> <string>CachingMethod</string>
<string>_write_</string> <string>cached_DMSBaseCategoryHash</string>
<string>_getiter_</string>
<string>base_category</string>
<string>_getattr_</string>
<string>context</string>
<string>basecatobject</string>
<string>sub_field_property_dict</string>
</tuple> </tuple>
</value> </value>
</item> </item>
...@@ -152,7 +157,11 @@ return sub_field_dict.values()\n ...@@ -152,7 +157,11 @@ return sub_field_dict.values()\n
<item> <item>
<key> <string>func_defaults</string> </key> <key> <string>func_defaults</string> </key>
<value> <value>
<tuple>
<tuple/>
<none/> <none/>
<int>0</int>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<tuple>
<string>Products.PythonScripts.PythonScript</string>
<string>PythonScript</string>
</tuple>
<none/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Python_magic</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>__ac_local_roles__</string> </key>
<value>
<none/>
</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 encoding="cdata"><![CDATA[
if len(name)<chars:\n
return name\n
a=name.split(\'/\')\n
if a[0]==\'\':a=a[1:]\n
dif=len(name)-chars\n
ind=1\n
while dif>0 and ind<len(a)-1:\n
dif=dif-len(a[ind])+2\n
a[ind]=\'..\'\n
ind+=1\n
return \'/\'.join(a)\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_filepath</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>name,chars</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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>name</string>
<string>chars</string>
<string>len</string>
<string>_getattr_</string>
<string>a</string>
<string>_getitem_</string>
<string>dif</string>
<string>ind</string>
<string>_write_</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>Base_trimPathName</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
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