<?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>portal = context.getPortalObject()  \n
if clear_catalog:\n
  # clear the catalog before reindexing\n
  catalog = portal.portal_catalog.getSQLCatalog(sql_catalog_id)\n
  catalog.manage_catalogClear()\n
\n
# Reindex person module\n
print "#### Indexing person_module, stage 1 ####"\n
person_module=getattr(portal, \'person_module\', None)\n
if person_module is not None :\n
  tag = \'person_stage_1\'\n
  person_module.activate(tag=tag).Folder_reindexAll(\n
                                         folder_tag=tag,\n
                                         object_tag=tag,\n
                                         sql_catalog_id=sql_catalog_id,\n
                                         passive_commit=passive_commit)\n
    \n
print "#### Indexing translations ####"\n
context.ERP5Site_updateTranslationTable(sql_catalog_id=sql_catalog_id)\n
\n
# Reindex categories\n
print "#### Indexing categories ####"\n
folder_tag = \'module\'\n
folder_after_tag = (\'person_stage_1\', \'group_person_stage_1\')\n
object_tag = \'category\'\n
object_after_tag = folder_after_tag\n
\n
context.portal_categories.activate(\n
                  tag=folder_tag,\n
                  after_tag=folder_after_tag).Folder_reindexAll(\n
                                         folder_tag=folder_tag,\n
                                         folder_after_tag=folder_after_tag,\n
                                         object_tag=object_tag,\n
                                         object_after_tag=object_after_tag,\n
                                         sql_catalog_id=sql_catalog_id,\n
                                         passive_commit=passive_commit)\n
\n
print "#### Indexing alarms ####"\n
print "#### Indexing preferences ####"\n
folder_tag = \'module\'\n
folder_after_tag = (\'category\', \'person_stage_1\', \'group_person_stage_1\')\n
object_tag = \'document\'\n
object_after_tag = folder_after_tag\n
object_priority = 2\n
for folder in [context.portal_alarms, context.portal_preferences]:\n
  folder.activate(\n
                    tag=folder_tag,\n
                    after_tag=folder_after_tag).Folder_reindexAll(\n
                                           folder_tag=folder_tag,\n
                                           folder_after_tag=folder_after_tag,\n
                                           object_tag=object_tag,\n
                                           object_after_tag=object_after_tag,\n
                                           object_priority=object_priority,\n
                                           sql_catalog_id=sql_catalog_id,\n
                                           passive_commit=passive_commit)\n
\n
# We index simulation first to make sure we can calculate tests\n
# (ie. related quantity)\n
print "#### Indexing simulation ####"\n
folder_tag = \'module\'\n
folder_after_tag = (\'category\', \'document\', \'person_stage_1\', \'group_person_stage_1\')\n
object_tag = \'simulation\'\n
object_after_tag = folder_after_tag\n
object_priority = 3\n
context.portal_simulation.activate(\n
                  tag=folder_tag,\n
                  after_tag=folder_after_tag).Folder_reindexAll(\n
                                         folder_tag=folder_tag,\n
                                         folder_after_tag=folder_after_tag,\n
                                         object_tag=object_tag,\n
                                         object_after_tag=object_after_tag,\n
                                         sql_catalog_id=sql_catalog_id,\n
                                         passive_commit=passive_commit)\n
\n
# We index templates secondly\n
print "#### Indexing templates ####"\n
# Next we index trash bins\n
print "#### Indexing trash bins ####"\n
# Next we index domains\n
print "#### Indexing domains ####"\n
# Next we index applied rules\n
print "#### Indexing applied rules ####"\n
# Next we index delivery builders\n
print "#### Indexing delivery builders ####"\n
# Next we index order builders\n
print "#### Indexing order builders ####"\n
\n
folder_tag = \'module\'\n
folder_after_tag = (\'category\', \'person_stage_1\', \'group_person_stage_1\')\n
object_tag = \'document\'\n
object_after_tag = folder_after_tag\n
object_priority = 2\n
for folder in [context.portal_templates, context.portal_trash,\n
               context.portal_domains, context.portal_rules,\n
               context.portal_deliveries, context.portal_orders]:\n
  folder.activate(\n
                    tag=folder_tag,\n
                    after_tag=folder_after_tag).Folder_reindexAll(\n
                                           folder_tag=folder_tag,\n
                                           folder_after_tag=folder_after_tag,\n
                                           object_tag=object_tag,\n
                                           object_after_tag=object_after_tag,\n
                                           object_priority=object_priority,\n
                                           sql_catalog_id=sql_catalog_id,\n
                                           passive_commit=passive_commit)\n
\n
# Then we index everything except inventories\n
for folder in portal.objectValues(("ERP5 Folder",)):\n
  print "#### Indexing contents inside folder %s ####" % folder.id\n
  if folder.getId() not in (\'inventory_module\',):\n
\n
    folder.activate(\n
              tag=folder_tag,\n
              after_tag=folder_after_tag).Folder_reindexAll(\n
                                     folder_tag=folder_tag,\n
                                     folder_after_tag=folder_after_tag,\n
                                     object_tag=object_tag,\n
                                     object_after_tag=object_after_tag,\n
                                     object_priority=object_priority,\n
                                     sql_catalog_id=sql_catalog_id,\n
                                     passive_commit=passive_commit)\n
\n
# Then we index inventories\n
object_tag = \'inventory\'\n
object_after_tag = (\'module\', \'category\', \'person_stage_1\', \'document\', \'group_person_stage_1\')\n
for folder in portal.objectValues(("ERP5 Folder",)):\n
  if folder.getId() in (\'inventory_module\',):\n
    print "#### Indexing contents inside folder %s ####" % folder.id\n
    folder.activate(\n
              tag=folder_tag,\n
              after_tag=folder_after_tag).Folder_reindexAll(\n
                                     folder_tag=folder_tag,\n
                                     folder_after_tag=folder_after_tag,\n
                                     object_tag=object_tag,\n
                                     object_after_tag=object_after_tag,\n
                                     object_priority=object_priority,\n
                                     sql_catalog_id=sql_catalog_id,\n
                                     passive_commit=passive_commit)\n
\n
# start activty from simulation because the erp5site is not an active object\n
context.portal_simulation.activate(\n
      after_tag=(\'inventory\', \'simulation\', \'person_stage_1\', \'group_person_stage_1\'),\n
      priority=3\n
      ).InventoryModule_reindexMovementList(\n
                            sql_catalog_id=sql_catalog_id,\n
                            passive_commit=passive_commit,\n
                            final_activity_tag=\'last_inventory_activity\')\n
\n
if final_activity_tag is not None:\n
  # Start a dummy activity which will get discarded when all started activities\n
  # (and all activities they trigger) are over.\n
  # Started on portal_simulation because activate does not work on portal object...\n
  # No idea if there is a better place.\n
  context.portal_simulation.activate(tag=final_activity_tag,\n
                                     after_tag=(\'module\', \'inventory\', \'simulation\', \'person_stage_1\',\n
                                                \'group_person_stage_1\', \'last_inventory_activity\', \'document\')\n
                                    ).getId()\n
\n
return printed\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>_owner</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>sql_catalog_id=None, passive_commit=1, clear_catalog=0, final_activity_tag=None</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>sql_catalog_id</string>
                            <string>passive_commit</string>
                            <string>clear_catalog</string>
                            <string>final_activity_tag</string>
                            <string>_print_</string>
                            <string>_print</string>
                            <string>_getattr_</string>
                            <string>context</string>
                            <string>portal</string>
                            <string>catalog</string>
                            <string>getattr</string>
                            <string>None</string>
                            <string>person_module</string>
                            <string>tag</string>
                            <string>folder_tag</string>
                            <string>folder_after_tag</string>
                            <string>object_tag</string>
                            <string>object_after_tag</string>
                            <string>object_priority</string>
                            <string>_getiter_</string>
                            <string>folder</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <tuple>
                <none/>
                <int>1</int>
                <int>0</int>
                <none/>
              </tuple>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>ERP5Site_reindexAll</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
