<?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>"""Return a list of possible GAP categories for a given account.\n
\n
if only_preferred_gap parameter is true, this will return only GAP\n
categories from the GAP set in preferences, otherwise it will return\n
categories from all available GAP.\n
"""\n
\n
display_cache = {}\n
\n
def display(x):\n
  if x not in display_cache:\n
    gap_id = x.getId()\n
    if gap_id.isdigit():\n
      display_cache[x] = "%s - %s" % (gap_id, x.getTitle())\n
    else:\n
      display_cache[x] = x.getTitle()\n
  return display_cache[x]\n
\n
def sort(x,y):\n
  return cmp(display(x), display(y))\n
\n
def getGapItemList(only_preferred_gap): \n
  ctool = context.getPortalObject().portal_categories\n
  if only_preferred_gap:\n
    gap_root = context.getPortalObject().portal_preferences\\\n
                    .getPreferredAccountingTransactionGap() or\\\n
                               context.getPortalDefaultGapRoot()\n
    return ctool.resolveCategory(gap_root).getCategoryChildItemList(\n
        base=0, is_self_excluded=1, display_method=display, sort_method=sort)\n
\n
  result = []  \n
  for country in ctool.gap.contentValues():\n
    for gap_root in country.contentValues():\n
      result.extend(gap_root.getCategoryChildItemList(\n
        base=0, is_self_excluded=1, display_method=display, sort_method=sort))\n
  return result\n
\n
from Products.ERP5Type.Cache import CachingMethod\n
getGapItemList = CachingMethod(getGapItemList, id=\'Account_getGapItemList\')\n
return getGapItemList(only_preferred_gap=only_preferred_gap)\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>only_preferred_gap=1</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>1</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>only_preferred_gap</string>
                            <string>display_cache</string>
                            <string>display</string>
                            <string>sort</string>
                            <string>getGapItemList</string>
                            <string>Products.ERP5Type.Cache</string>
                            <string>CachingMethod</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <int>1</int>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Account_getGapItemList</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
