<?xml version="1.0"?>
<ZopeData>
  <record id="1" aka="AAAAAAAAAAE=">
    <pickle>
      <tuple>
        <global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
        <tuple/>
      </tuple>
    </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 encoding="cdata"><![CDATA[

cat_info_list = []\n
for base_cat_id in context.REQUEST[\'category_list\']:\n
  base_cat = context.portal_categories[base_cat_id]\n
  d = dict()\n
  d[\'base_cat\'] = base_cat\n
  d[\'cat_list\'] = cat_list = []\n
  d[\'max_cat_depth\'] = max_cat_depth = 0\n
  cat_info_list.append(d)\n
  for cat in context.portal_catalog(portal_type=\'Category\',\n
                                    sort_on=((\'path\', \'ascending\'),),\n
                                    limit=None,\n
                                    **{\'default_%s_uid\' % (base_cat.getId(),): base_cat.getUid()}):\n
    d[\'cat_list\'].append(cat)\n
    cat_depth = len(cat.getRelativeUrl().split(\'/\'))\n
    if cat_depth > d[\'max_cat_depth\']:\n
      d[\'max_cat_depth\'] = cat_depth\n
\n
result = []\n
for cat_info in cat_info_list:\n
  table_dict = dict()\n
  table_dict[\'name\'] = cat_info[\'base_cat\'].getId()\n
  table_dict[\'row_list\'] = row_list = []\n
  result.append(table_dict)\n
\n
  # make headers\n
  header_dict = dict()\n
  table_dict[\'header_row\'] = header_dict\n
\n
  cat_list = cat_info[\'cat_list\']\n
  if cat_list:\n
    max_cat_depth = cat_info[\'max_cat_depth\']\n
    header_dict[\'path_cell_list\'] = [\'\'] * (max_cat_depth - 1)\n
    header_dict[\'path_cell_list\'][0] = \'Path\'\n
    header_dict[\'category_property_list\'] = [\' \'.join([s.capitalize() for s in property_id.split(\'_\')]) for property_id in cat_list[0].getPropertyIdList() if property_id != \'uid\']\n
                                             \n
    for cat in cat_list:\n
      row = dict()\n
      row[\'path_cell_list\'] = [\'\'] * (max_cat_depth - 1)\n
      row[\'path_cell_list\'][len(cat.getRelativeUrl().split(\'/\')) - 2] = \'*\'\n
      row[\'category_property_list\'] = [item[1] for item in cat.getPropertyItemList() if item[0] != \'uid\']\n
      row_list.append(row) \n
  else:\n
    header_dict[\'path_cell_list\'] = [\'Path\']\n
    header_dict[\'category_property_list\'] = []\n
\n
return result\n
#vim: filetype=python\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>cat_info_list</string>
                            <string>_getiter_</string>
                            <string>_getitem_</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>base_cat_id</string>
                            <string>base_cat</string>
                            <string>dict</string>
                            <string>d</string>
                            <string>_write_</string>
                            <string>cat_list</string>
                            <string>max_cat_depth</string>
                            <string>_apply_</string>
                            <string>None</string>
                            <string>cat</string>
                            <string>len</string>
                            <string>cat_depth</string>
                            <string>result</string>
                            <string>cat_info</string>
                            <string>table_dict</string>
                            <string>row_list</string>
                            <string>header_dict</string>
                            <string>append</string>
                            <string>$append0</string>
                            <string>property_id</string>
                            <string>$append1</string>
                            <string>s</string>
                            <string>row</string>
                            <string>item</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>CategoryTool_constructCategoryTableToExport</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
