Commit 098ebbcc authored by Yusei Tahara's avatar Yusei Tahara

Fix CategoryTool_constructCategoryTableToExport. Sometimes categories were...

Fix CategoryTool_constructCategoryTableToExport. Sometimes categories were wrongly sorted and incorrect category definitions were exported.
parent f8cd92d3
...@@ -66,14 +66,19 @@ for base_cat_id in context.REQUEST[\'category_list\']:\n ...@@ -66,14 +66,19 @@ for base_cat_id in context.REQUEST[\'category_list\']:\n
d[\'cat_list\'] = cat_list = []\n d[\'cat_list\'] = cat_list = []\n
d[\'max_cat_depth\'] = max_cat_depth = 0\n d[\'max_cat_depth\'] = max_cat_depth = 0\n
cat_info_list.append(d)\n cat_info_list.append(d)\n
temporary_category_list = []\n
for cat in context.portal_catalog(portal_type=\'Category\',\n for cat in context.portal_catalog(portal_type=\'Category\',\n
sort_on=((\'path\', \'ascending\'),),\n sort_on=((\'path\', \'ascending\'),),# This sorting is not enough.\n
limit=None,\n limit=None,\n
**{\'default_%s_uid\' % (base_cat.getId(),): base_cat.getUid()}):\n **{\'default_%s_uid\' % (base_cat.getId(),): base_cat.getUid()}):\n
d[\'cat_list\'].append(cat)\n cat_relative_url_path_list = cat.getRelativeUrl().split(\'/\')\n
cat_depth = len(cat.getRelativeUrl().split(\'/\'))\n cat_depth = len(cat_relative_url_path_list)\n
temporary_category_list.append((cat_relative_url_path_list, cat))\n
if cat_depth > d[\'max_cat_depth\']:\n if cat_depth > d[\'max_cat_depth\']:\n
d[\'max_cat_depth\'] = cat_depth\n d[\'max_cat_depth\'] = cat_depth\n
# Sort by split path by Python, if you sort with "/" by MySQL, then the result will be like (\'A\',\'A_B/1\',\'A_B/2\',\'A/1\',\'A/2\')\n
temporary_category_list.sort()\n
d[\'cat_list\'] = [i[1] for i in temporary_category_list]\n
\n \n
result = []\n result = []\n
for cat_info in cat_info_list:\n for cat_info in cat_info_list:\n
......
Fix CategoryTool_constructCategoryTableToExport. Sometimes categories were wrongly sorted and incorrect category definitions were exported.
2011-02-25 arnaud.fontaine 2011-02-25 arnaud.fontaine
* Proxify all the fields in BaseType_view and PreferenceType_view. * Proxify all the fields in BaseType_view and PreferenceType_view.
* Fix type_interface_list which was not displayed properly in BaseType_view and PreferenceType_view. * Fix type_interface_list which was not displayed properly in BaseType_view and PreferenceType_view.
......
40955 40956
\ No newline at end of file \ 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