<?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 encoding="cdata"><![CDATA[

from ZODB.POSException import ConflictError\n
portal = context.getPortalObject()\n
N_ = portal.Base_translateString\n
\n
selected_uids = context.portal_selections.updateSelectionCheckedUidList(selection_name,listbox_uid,uids)\n
uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
\n
error = context.portal_selections.selectionHasChanged(md5_object_uid_list,uids)\n
\n
REQUEST=context.REQUEST\n
qs = \'\'\n
ret_url = \'\'\n
\n
def Object_hasRelation(object):\n
  # Check if there is some related objets.\n
  result = 0\n
  for o in object.getIndexableChildValueList():\n
    for related in object.portal_categories.getRelatedValueList(object):\n
      if related.getRelativeUrl().startswith(object.getRelativeUrl()):\n
        continue\n
      elif related.getRelativeUrl().startswith(\'portal_simulation\') :\n
        continue\n
      else:\n
        result = 1\n
        break\n
  return result\n
\n
ret_url = context.absolute_url() + \'/\' + form_id\n
if error:\n
  message = N_("Sorry+your+selection+has+changed")\n
  qs = \'?portal_status_message=%s\' % message\n
elif uids is not None:\n
  # Check if there is some related objets.\n
  object_used = 0\n
  for uid in uids:\n
    object = context.portal_catalog(uid=uid)[0].getObject()\n
    if Object_hasRelation(object):\n
      object_used += 1\n
  if object_used>0:\n
      if object_used == 1:\n
        message = N_("Sorry,+1+Item+Is+In+Use.")\n
        qs = \'?portal_status_message=%s\' % message\n
      else:\n
        message = N_("Sorry,+${count}+Items+Are+In+Use.",\n
                     mapping={\'count\': repr(object_used)})\n
        qs = \'?portal_status_message=%s\' % message  \n
  else:\n
    try : \n
      context.manage_delObjects(uids=uids, REQUEST=REQUEST)\n
      message = N_("Deleted.")\n
      qs = \'?portal_status_message=%s\' % message\n
    except ConflictError : raise\n
    except Exception, message : \n
      qs = \'?portal_status_message=%s\' % message\n
else:\n
  message = N_("Please+select+one+or+more+items+first.")\n
  qs = \'?portal_status_message=%s\' % message\n
\n
return REQUEST.RESPONSE.redirect( ret_url + qs )\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/local_erp5/Folder_delete</string> </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>form_id=\'\',selection_index=None,object_uid=None,selection_name=None,field_id=None,uids=None,cancel_url=\'\',listbox_uid=[],md5_object_uid_list=\'\'</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>9</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>form_id</string>
                            <string>selection_index</string>
                            <string>object_uid</string>
                            <string>selection_name</string>
                            <string>field_id</string>
                            <string>uids</string>
                            <string>cancel_url</string>
                            <string>listbox_uid</string>
                            <string>md5_object_uid_list</string>
                            <string>ZODB.POSException</string>
                            <string>ConflictError</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>portal</string>
                            <string>N_</string>
                            <string>selected_uids</string>
                            <string>error</string>
                            <string>REQUEST</string>
                            <string>qs</string>
                            <string>ret_url</string>
                            <string>Object_hasRelation</string>
                            <string>message</string>
                            <string>None</string>
                            <string>object_used</string>
                            <string>_getiter_</string>
                            <string>uid</string>
                            <string>_getitem_</string>
                            <string>object</string>
                            <string>repr</string>
                            <string>Exception</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <string></string>
                <none/>
                <none/>
                <none/>
                <none/>
                <none/>
                <string></string>
                <list/>
                <string></string>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Folder_delete</string> </value>
        </item>
        <item>
            <key> <string>title</string> </key>
            <value> <string>Delete objects from a folder</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
