<?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>REQUEST = container.REQUEST\n
\n
\n
bt_id_list = getattr(REQUEST, \'bt_list\', ())\n
if len(bt_id_list) == 0:\n
  bt_id_list = kw.get(\'bt_list\', ())\n
\n
if \'MultiInstallationDialog\' in getattr(REQUEST, \'current_form_id\', \'\'):\n
  check_dependencies = 0\n
else:\n
  check_dependencies = 1\n
\n
from Products.ERP5Type.Document import newTempBase\n
from Products.ERP5Type.Cache import CachingMethod\n
\n
def getModifiedObjectList(bt):\n
  return bt.preinstall(check_dependencies = check_dependencies)\n
\n
getModifiedObjectList = CachingMethod(getModifiedObjectList, \n
                                      id=\'BusinessTemplate_getModifiedObjectList\',\n
                                      cache_factory=\'erp5_ui_medium\')\n
\n
bt_objects = {}\n
\n
for bt_id in bt_id_list:\n
  bt = context.portal_templates[bt_id]\n
  bt_objects[bt.getId()] = [bt.getTitle(), getModifiedObjectList(bt)]\n
\n
object_list = []\n
no_backup_list = [\'Action\', \'SiteProperty\', \'Module\', \'Document\', \n
                  \'PropertySheet\', \'Extension\', \'Test\', \'Product\', \n
                  \'Role\', \'CatalogResultKey\', \'CatalogRelatedKey\', \n
                  \'CatalogResultTable\', \'MessageTranslation\', \'LocalRoles\', \n
                  \'PortalTypeAllowedContentType\', \'PortalTypeHiddenContentType\', \n
                  \'PortalTypePropertySheet\', \'PortalTypeBaseCategory\']\n
\n
for bt in bt_id_list:\n
  modified_object_list = bt_objects[bt][1]  \n
  bt_title = bt_objects[bt][0]\n
  keys = modified_object_list.keys()\n
  keys.sort()\n
  i = 0\n
  for object_id in keys:    \n
    object_state, object_class = modified_object_list[object_id]\n
    object_id = bt+\'|\'+object_id\n
    line = newTempBase(context, \'tmp_install_%s\' %(str(i)))\n
    if object_state == \'New\':\n
      line.edit(object_id=object_id,\n
                bt_title = bt_title, \n
                object_state=object_state, \n
                object_class=object_class, \n
                choice_item_list=[[\'Install\', \'install\']])\n
    elif object_state == \'Modified\':\n
      if object_class in no_backup_list:\n
        line.edit(object_id=object_id, \n
                  bt_title = bt_title, \n
                  object_state=object_state, \n
                  object_class=object_class, \n
                  choice_item_list=[[\'Upgrade\', \'install\']])\n
      else:\n
        line.edit(object_id=object_id, \n
                  bt_title = bt_title, \n
                  object_state=object_state, \n
                  object_class=object_class, \n
                  choice_item_list=[[\'Backup And Upgrade\', \'backup\']])\n
    \n
    elif object_state == \'Removed\':\n
      if object_class in no_backup_list:\n
        line.edit(object_id=object_id, \n
                  bt_title = bt_title, \n
                  object_state=object_state, \n
                  object_class=object_class, \n
                  choice_item_list=[[\'Remove\', \'remove\']])\n
      else:\n
        line.edit(object_id=object_id, \n
                  bt_title = bt_title, \n
                  object_state=object_state, \n
                  object_class=object_class, \n
                  choice_item_list=[[\'Backup And Remove\', \'save_and_remove\']])\n
    line.setUid(\'new_%s\' % object_id)\n
    object_list.append(line)\n
  i += 1 \n
\n
return object_list\n
</string> </value>
        </item>
        <item>
            <key> <string>_code</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>_params</string> </key>
            <value> <string>**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>0</int> </value>
                    </item>
                    <item>
                        <key> <string>co_varnames</string> </key>
                        <value>
                          <tuple>
                            <string>kw</string>
                            <string>_getattr_</string>
                            <string>container</string>
                            <string>REQUEST</string>
                            <string>getattr</string>
                            <string>bt_id_list</string>
                            <string>len</string>
                            <string>check_dependencies</string>
                            <string>Products.ERP5Type.Document</string>
                            <string>newTempBase</string>
                            <string>Products.ERP5Type.Cache</string>
                            <string>CachingMethod</string>
                            <string>getModifiedObjectList</string>
                            <string>bt_objects</string>
                            <string>_getiter_</string>
                            <string>bt_id</string>
                            <string>_getitem_</string>
                            <string>context</string>
                            <string>bt</string>
                            <string>_write_</string>
                            <string>object_list</string>
                            <string>no_backup_list</string>
                            <string>modified_object_list</string>
                            <string>bt_title</string>
                            <string>keys</string>
                            <string>i</string>
                            <string>object_id</string>
                            <string>object_state</string>
                            <string>object_class</string>
                            <string>str</string>
                            <string>line</string>
                            <string>_inplacevar_</string>
                          </tuple>
                        </value>
                    </item>
                  </dictionary>
                </state>
              </object>
            </value>
        </item>
        <item>
            <key> <string>func_defaults</string> </key>
            <value>
              <none/>
            </value>
        </item>
        <item>
            <key> <string>id</string> </key>
            <value> <string>TemplateTool_getModifiedObjectList</string> </value>
        </item>
        <item>
            <key> <string>warnings</string> </key>
            <value>
              <tuple/>
            </value>
        </item>
      </dictionary>
    </pickle>
  </record>
</ZopeData>
