<?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># Reindex objects which indexation_timestamp is at most\n
# delta seconds before current time (ie, bound inclued).\n
# Unindex objects which cannot be found.\n
# Default delta is 172800 (=2*24*60*60=2 days)\n
\n
portal = context.getPortalObject()\n
catalog = portal.portal_catalog.getSQLCatalog()\n
candidate_list = context.ERP5Site_zGetLatestIndexedObjectList(delta=delta)\n
\n
reindex_count = 0\n
unindex_count = 0\n
\n
for candidate in candidate_list:\n
  path = candidate[\'path\']\n
  try:\n
    object = portal.restrictedTraverse(path)\n
  except KeyError:\n
    # Object is unreachable, remove it from catalog\n
    # Use SQLQueue because all activities are triggered on the same object,\n
    # and SQLDict keeps only one.\n
    catalog.activate(activity="SQLQueue").unindexObject(uid=candidate[\'uid\'])\n
    unindex_count += 1\n
  else:\n
    object.reindexObject()\n
    reindex_count += 1\n
\n
print \'%s object reindexed, %s object unindexed\' % (reindex_count, unindex_count)\n
return printed\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>delta=172800</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>delta</string>
                            <string>_print_</string>
                            <string>_print</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>portal</string>
                            <string>catalog</string>
                            <string>candidate_list</string>
                            <string>reindex_count</string>
                            <string>unindex_count</string>
                            <string>_getiter_</string>
                            <string>candidate</string>
                            <string>_getitem_</string>
                            <string>path</string>
                            <string>object</string>
                            <string>KeyError</string>
                            <string>_inplacevar_</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <int>172800</int>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>ERP5Site_reindexLatestIndexedObjects</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
