<?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> <string encoding="base64">O/INCg==</string> </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>from Products.ERP5Type.Document import newTempBase\n
from string import zfill\n
\n
\n
request = context.REQUEST\n
\n
# It must be possible to initialise the fast input, and to add empty lines after\n
if request.has_key(\'my_empty_line_number\'):\n
  empty_line_number = request[\'my_empty_line_number\']\n
\n
\n
l = []\n
first_empty_line_id = 1\n
portal_object = context.getPortalObject()\n
int_len = 3\n
\n
if hasattr(request, \'listbox\'):\n
  # initialize the listbox \n
  listbox=request[\'listbox\']\n
\n
  keys_list = listbox.keys()\n
\n
  if keys_list != []:\n
    keys_list.sort(lambda x,y: cmp(int(x),int(y)))\n
    first_empty_line_id = int(keys_list[-1])+1\n
\n
  for i in keys_list:\n
    o = newTempBase(portal_object, i)\n
    o.setUid(\'new_%s\' % zfill(i,int_len))\n
\n
    is_empty = 1\n
\n
    for key in listbox[i]:\n
      value = listbox[i][key]\n
      # 0 was added because of checkbox field in some fast input\n
      if (value not in [\'\',None,0]) and (key != \'listbox_key\'):\n
        is_empty = 0\n
      if (request.has_key(\'field_errors\')):\n
        is_empty = 0\n
      #o.edit(key=listbox[i][key])\n
      o.setProperty(key,listbox[i][key])\n
\n
    if not is_empty:\n
      l.append(o)\n
    \n
# add empty lines\n
if not(request.has_key(\'field_errors\')):\n
  for i in range(first_empty_line_id,first_empty_line_id+empty_line_number):\n
\n
    o = newTempBase(portal_object, str(i))\n
    o.setUid(\'new_%s\' % zfill(i,int_len))   \n
    # zfill is used here to garantee sort order - XXX - cleaner approach required\n
    l.append(o)\n
\n
\n
return l\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_filepath</string> </key>
            <value> <string>Script (Python):/nexedi/portal_skins/erp5_core/ListBox_initializeFastInput</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>empty_line_number=0, **kw</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>empty_line_number</string>
                            <string>kw</string>
                            <string>Products.ERP5Type.Document</string>
                            <string>newTempBase</string>
                            <string>string</string>
                            <string>zfill</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>request</string>
                            <string>_getitem_</string>
                            <string>l</string>
                            <string>first_empty_line_id</string>
                            <string>portal_object</string>
                            <string>int_len</string>
                            <string>hasattr</string>
                            <string>listbox</string>
                            <string>keys_list</string>
                            <string>int</string>
                            <string>_getiter_</string>
                            <string>i</string>
                            <string>o</string>
                            <string>is_empty</string>
                            <string>key</string>
                            <string>value</string>
                            <string>None</string>
                            <string>range</string>
                            <string>str</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <int>0</int>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>ListBox_initializeFastInput</string> </value>
        </item>
        <item>
            <key> <string>title</string> </key>
            <value> <string></string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
