<?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[

portal = context.getPortalObject()\n
Base_translateString = portal.Base_translateString\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
selected_uids = context.portal_selections.updateSelectionCheckedUidList(selection_name,listbox_uid,uids)\n
uids = context.portal_selections.getSelectionCheckedUidsFor(selection_name)\n
# make sure nothing is checked after\n
context.portal_selections.setSelectionCheckedUidsFor(selection_name, [])\n
request=context.REQUEST\n
\n
\n
\n
if uids != []:\n
  # Check if there is some related objets.\n
  object_used = 0\n
\n
  object_list = [x.getObject() for x in context.portal_catalog(uid=uids)]\n
  object_used = sum([Object_hasRelation(x) for x in object_list])\n
\n
  if object_used > 0:\n
    if object_used == 1:\n
      message = Base_translateString("Sorry, 1 item is in use.")\n
    else:\n
      message = Base_translateString("Sorry, ${count} items are in use.",\n
                                     mapping={\'count\': repr(object_used)})\n
    qs = \'?portal_status_message=%s\' % message  \n
  else:\n
    context.manage_cutObjects(uids=uids, REQUEST=request)\n
    message = Base_translateString("Items cut.")\n
else:\n
  message = Base_translateString("Please select one or more items to cut first.")\n
\n
return context.Base_redirect(form_id, keep_items=dict(portal_status_message=message))\n


]]></string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>form_id, selection_name=\'\', uids=[], listbox_uid=[]</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>4</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>form_id</string>
                            <string>selection_name</string>
                            <string>uids</string>
                            <string>listbox_uid</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>portal</string>
                            <string>Base_translateString</string>
                            <string>Object_hasRelation</string>
                            <string>selected_uids</string>
                            <string>request</string>
                            <string>object_used</string>
                            <string>append</string>
                            <string>$append0</string>
                            <string>_getiter_</string>
                            <string>x</string>
                            <string>object_list</string>
                            <string>sum</string>
                            <string>message</string>
                            <string>repr</string>
                            <string>qs</string>
                            <string>dict</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <string></string>
                <list/>
                <list/>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>Folder_cut</string> </value>
        </item>
        <item>
            <key> <string>title</string> </key>
            <value> <string>Cut objects from a folder and copy to the clipboard</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
