Commit e4a18449 authored by Rafael Monnerat's avatar Rafael Monnerat

Initial erp5_upgrader upload



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36282 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d0ea26bf
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2008-2009 Nexedi SA and Contributors. All Rights Reserved.
# Rafael Monnerat <rafael@nexedi.com>
# Ivan Tyagov <ivan@nexedi.com>
# Yusei TAHARA <yusei@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from App.config import getConfiguration
from Products.ERP5Type.Log import log
from Products.CMFActivity.ActiveResult import ActiveResult
from time import sleep
import os
from Acquisition import aq_base
def ERP5Site_editERP5SiteProperty(self, prop, value):
"""
The ERP5Site miss this method, so we implement.
"""
portal = self.getPortalObject()
method = portal._setProperty
if portal.hasProperty(prop):
method = portal._updateProperty
method(prop, value)
return True
def ERP5Site_verifyProductPathUpgrade(self):
"""
Due activities concurrency, it is needed that the upgrade process
only proceed after restart be sucessfully done.
This script make sure that the process will wait for the
Prodcuts be upgraded to proceed.
This method is not elegant solution but it is essential part
between restart zope and update Activities.
"""
# check if the products are already updated.
if len(self.ERP5Site_upgradeProductPath()) > 0:
# Wait at least 20 seconds before try again
# This will prevent the activities be invoked
# too early.
sleep(20)
# Force failure for restart the activity
raise
return
def ERP5Site_restartZopeInstance(self):
"""
Zope must be restart after update the Products or Software
But the restart into one activity, will make the activity always
fail and with the server will be restart many times.
This method use a flag to define if the server was already restarted.
If yes, the flag is removed and the restart will be ignored.
This method should be run into a single activity to prevent rollback
other parts.
"""
import Lifetime
Lifetime.shutdown(1,fast=1)
log("Zope Restart was launched.")
active_result = ActiveResult()
active_result.edit(summary="Zope Restart",
severity=0,
detail="Zope was restart Sucessfully.")
return active_result
def ERP5Site_clearActivities(self):
"""
This method is used to recreated the activities keeping the
previous activities from one activity. The issue related to recreate
the Activity tables from one activity is that the activity (this method)
is also recreated, so it is kept for ever.
This method use a flag to define if the portal already recreated the
activities table. If yes, the flag is removed and the recreation will
be ignored.
This method should be run into a single activity to prevent some action
be excetured many times other parts.
"""
instance_home = getConfiguration().instancehome
flag_fs_path = instance_home + "/ACTIVITY_RECREATE_FLAG"
log("Start to Clear activities.")
if not os.path.exists(flag_fs_path):
try:
flag = open(flag_fs_path, 'w+')
log("Clear Activities")
self.getPortalObject().portal_activities.manageClearActivities(keep=1)
active_result = ActiveResult()
active_result.edit(summary="Activities Recreated",
severity=0,
detail="Activities Tables was recreated Sucessfully.")
return active_result
except:
os.remove(flag_fs_path)
raise
os.remove(flag_fs_path)
return
def ERP5Site_upgradeMySQLCharset(self, upgrade=0):
"""
Update the catalog charset running a external command.
"""
from subprocess import Popen, PIPE
portal = self.getPortalObject()
message_list = []
database = portal.erp5_sql_connection.connection_string.split(' ')[0]
connection_string = ''
if '@' in database:
# This means the format database@hostname:port was used.
connection_string += ' -u root '
database_name , hostname = database.split("@")
if ":" in hostname:
new_hostname, port = hostname.split(":")
hostname = new_hostname
connection_string += ' --port=%s ' % port
connection_string += ' --host=%s ' % hostname
database = database_name
message = "ERP5Site_verifyMySQLCharset: Invalid configuration for: %s (%s)"
command = "echo \"show variables like '%%char%%'\" | mysql %s %s -Ns" % (connection_string, database)
stdout, stderr = Popen(command, stderr=PIPE, stdout=PIPE,
close_fds=True, shell=True).communicate()
for line in stdout.split("\n"):
if not line.strip(" ") == "" and \
not ('character_set_filesystem' in line and 'binary' in line) and \
not ('character_sets_dir' in line) and \
not ('utf8' in line and 'character_set_filesystem' not in line):
message_list.append(message % (database, line.replace("\t", " = ")))
if not upgrade:
return message_list
if len(message_list) > 0:
message_list = ["Upgrade was required to ERP5Site_verifyMySQLCharset."]
SQL = portal.ERP5Site_getUpgradeCatalogCharsetSQL(context=portal)
command = "echo '%s' | mysql %s " % (SQL, connection_string)
stdout, stderr = Popen(command, stderr=PIPE, stdout=PIPE,
close_fds=True, shell=True).communicate()
message_list.append("Upgrade Executed required to ERP5Site_upgradeMySQLCharset.")
message_list.append("ERP5Site_upgraadeMySQLCharset STDERR: %s" % stderr)
message_list.append("ERP5Site_upgradeMySQLCharset STDOUT: %s" % stdout)
return message_list
def ERP5Site_runVerificationScript(self, method_id):
""" Run a Python Script return the method. This should avoid raise error,
even one intergrity verification script raise error, and provide good
information.
"""
method = getattr(self.getPortalObject(), method_id, None)
if method is None:
return 'Script %s was not Found!' % (method_id)
try:
integrity_result = method()
except Exception, e:
# Is it required include the trace back
return 'Script %s fail to run, Exception: %s , message: %s .' % (method_id, e.__class__, e )
if len(integrity_result) > 0:
return '%s : \n - %s ' % (method_id, '\n - '.join(integrity_result))
def TemplateTool_reinstallBT5(self, bt5_title, update_catalog=0):
"""This method get the installed Business Template,
then reinstall it to overwrite all local changes.
"""
portal = self.getPortalObject()
portal_templates = portal.portal_templates
installed_bt5 = portal_templates.getInstalledBusinessTemplate(bt5_title)
BusinessTemplate_getModifiedObject = \
aq_base(getattr(portal, 'BusinessTemplate_getModifiedObject', None))
if BusinessTemplate_getModifiedObject is None:
portal.changeSkin('View')
BusinessTemplate_getModifiedObject = \
aq_base(portal.BusinessTemplate_getModifiedObject)
install_kw = {}
listbox_object_list = BusinessTemplate_getModifiedObject.__of__(installed_bt5)()
for listbox_line in listbox_object_list:
install_kw[listbox_line.object_id] = listbox_line.choice_item_list[0][1]
# Call reinstall
installed_bt5.reinstall(object_to_update=install_kw,
update_catalog=update_catalog)
log("Reinstalled %s" % (bt5_title,))
def ERP5Site_changeAuthoredDocumentListOwnership(self, old_owner, new_owner):
"""
Change owneship for all documents in the system belonging to
an user (i.e. represented by user_name/reference).
"""
# Move import to here prevents the raise error when this External
# Be imported during the upgrade.
from Products.ERP5Type.Utils import _setSuperSecurityManager
from AccessControl.SecurityManagement import setSecurityManager
from Products.ERP5Security.ERP5UserManager import SUPER_USER
result = []
orginal_security_manager = _setSuperSecurityManager(self, SUPER_USER)
portal = self.getPortalObject()
user_folder = portal.acl_users
new_owner_as_user = user_folder.getUserById(new_owner).__of__(user_folder)
document_list = portal.portal_catalog.unrestrictedSearchResults(owner = old_owner)
for document in document_list:
document = document.getObject()
# change document ownership
document.changeOwnership(new_owner_as_user)
# fix local roles
for item in document.get_local_roles():
user = item[0]
role_list = item[1]
if user == old_owner:
# replace old Owner with new One
document.manage_delLocalRoles((old_owner,))
document.manage_setLocalRoles(new_owner, role_list)
result.append(document.getRelativeUrl())
# finally reindex document
document.reindexObject()
# restore security
setSecurityManager(orginal_security_manager)
return dict(old_owner = old_owner, \
new_owner = new_owner, \
changed_document_list = result)
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>always</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This Alarm check that bt5 are the right ones. If not, it upgrades the bt5 using SVN (for dedicate instances) or using shared repository for Free / Express instances.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>bt5_upgrader</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1136073600.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value> <string>Alarm_senseBT5Version</string> </value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_upgradeBT5Version</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>BT5 Upgrader</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>always</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This business template finalize the upgrade, this should contains the last steps of upgrade system (ie.: Clear Cache).</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>finalize_upgrader</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1136073600.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value> <string>Alarm_senseFinalizeUpgrade</string> </value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_upgradeFinalize</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Finalize Upgrader</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>always</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This Alarm check that products are the right ones. If not, it upgrades the products using SVN (for dedicate instances) or using PRODUCT HOME for Free / Express instances.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>product_upgrader</string> </value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1136073600.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value> <string>Alarm_senseProductVersion</string> </value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_upgradeProductVersion</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Product Upgrader</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>always</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>Makes sure that we using the appropriate version of the system (ie.Python, Zope, libraries, etc.). System in this case refer to a Plataform (zope, python, local libraries...). This alarms can detect system upgrade required and upgrade it.</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>system_upgrader</string> </value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1136073600.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value> <string>Alarm_senseSystemVersion</string> </value>
</item>
<item>
<key> <string>solve_method_id</string> </key>
<value> <string>Alarm_upgradeSystemVersion</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>System Upgrader</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Alarm" module="Products.ERP5Type.Document.Alarm"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_senseUpgradeNeed</string> </value>
</item>
<item>
<key> <string>alarm_notification_mode</string> </key>
<value>
<tuple>
<string>never</string>
</tuple>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value> <string>This alarms acts as a cron job. It will start an instance upgrade if any of the following this alarms sequence:\n
1) system_upgrader (supported)\n
2) product_upgrader (supported)\n
3) bt5_upgrader (supported)\n
4) finalize_upgrader (supported)\n
\n
"sense" a need of an upgrade. This alarm is likely to disappear soon as it\'s needed due to lack of functionality (which is that alarms can not automatically "solve" themselves).</string> </value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>upgrader_controller</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>30</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1136073600.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Upgrader Controller</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
business_template = state_change[\'object\']\n
listbox = state_change.kwargs.get(\'listbox\')\n
update_catalog = state_change.kwargs.get(\'update_catalog\')\n
update_translation = state_change.kwargs.get(\'update_translation\')\n
workflow_action = state_change.kwargs.get(\'workflow_action\')\n
\n
object_to_update = {}\n
if listbox is not None and len(listbox) > 0:\n
for item in listbox:\n
if item[\'choice\']:\n
# Choice parameter is now selected with a MultiCheckBoxField with only one element\n
# Business Template need to get a string and not a list\n
object_to_update[item[\'listbox_key\']] = item[\'choice\'][0]\n
else:\n
object_to_update[item[\'listbox_key\']] = "nothing"\n
\n
if workflow_action == \'install_action\':\n
business_template.install(force=0, object_to_update=object_to_update, \\\n
update_catalog=update_catalog, update_translation=update_translation)\n
elif workflow_action == \'reinstall_action\':\n
business_template.reinstall(force=0, object_to_update=object_to_update, \\\n
update_catalog=update_catalog, update_translation=update_translation)\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>state_change</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>state_change</string>
<string>_getitem_</string>
<string>business_template</string>
<string>_getattr_</string>
<string>listbox</string>
<string>update_catalog</string>
<string>update_translation</string>
<string>workflow_action</string>
<string>object_to_update</string>
<string>None</string>
<string>len</string>
<string>_getiter_</string>
<string>item</string>
<string>_write_</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>BusinessTemplate_install</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="Folder" module="OFS.Folder"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>1.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_upgrader</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>from Products.ERP5Type.Log import log\n
from Products.CMFActivity.ActiveResult import ActiveResult\n
\n
# Log Result to make debug easy in case of failure.\n
log("Summary: %s , Details: %s " % (summary, detail))\n
\n
active_result = ActiveResult()\n
active_result.edit(summary=summary, severity=severity, detail=detail)\n
return active_result\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>summary, severity=0, detail</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>3</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>summary</string>
<string>severity</string>
<string>detail</string>
<string>Products.ERP5Type.Log</string>
<string>log</string>
<string>Products.CMFActivity.ActiveResult</string>
<string>ActiveResult</string>
<string>active_result</string>
<string>_getattr_</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_saveActiveResult</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Here we make sure the installed bt5 are the right ones.\n
If the installed bt5 are too old, then they must be upgraded\n
\n
NOTE: some day, we will mix multiple bt5 sources. The code\n
will be a bit longer. It could be a good idea to create\n
a kind of dict or a central data structure somewhere (like\n
the system signature in portal_introspections) instead of\n
having to repeat everywhere 5.4.3 or other release numbers.\n
\n
NOTE: the idea is to call a long list of "check list" scripts,\n
each of which has a "check" part and a "fix" (ie. upgrade) part, just like\n
constraints in ERP5. However, the order is very important\n
for upgrade, unlike constraints. And we need to be able\n
to override upgrade scripts for certain source releases.\n
\n
NOTE2: you can split if needed the upgrade process into more\n
alarms (this can be useful if restart is needed for example\n
between stages of upgrade)\n
"""\n
# Setup skins\n
context.ERP5Site_setupUpgraderSkinSelection()\n
\n
# Right way is like this\n
# Now start the update\n
\n
if len(context.ERP5Site_upgradeBusinessTemplateList()) > 0: \n
return True\n
\n
return False\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>context</string>
<string>len</string>
<string>True</string>
<string>False</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>Alarm_senseBT5Version</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Finalize Upgrade is the final step of upgrader. Here should contains\n
the scripts that should be executed after the business template installation.\n
"""\n
# Setup skins\n
context.ERP5Site_setupUpgraderSkinSelection()\n
\n
# Verify if is required upgrade Global Site Properties. \n
if len(context.ERP5Site_upgradeGlobalPropertyList()) > 0:\n
return True\n
\n
if len(context.ERP5Site_upgradeValidationStateList()) > 0: \n
return True\n
\n
if len(context.ERP5Site_upgradeWorkflowChain()) > 0:\n
return True\n
\n
if len(context.ERP5Site_upgradeData()) > 0: \n
return True\n
\n
if len(context.ERP5Site_upgradePortalTypePropertySheet()) > 0: \n
return True\n
\n
if len(context.ERP5Site_upgradeSecurity()) > 0: \n
return True\n
\n
if len(context.ERP5Site_upgradeSQLCatalogFilter()) > 0: \n
return True\n
\n
if len(context.ERP5Site_upgradeSQLCatalog()) > 0: \n
return True\n
\n
# (rafael) Maybe this is dangerous, enable it when this\n
# is appropriated tested.\n
#if len(context.ERP5Site_upgradeMySQLCharset()) > 0: \n
# return True\n
\n
return False\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>context</string>
<string>len</string>
<string>True</string>
<string>False</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>Alarm_senseFinalizeUpgrade</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Here we make sure the installed products are the right ones\n
"""\n
# check if upgrade is needed\n
return len(context.ERP5Site_upgradeProductPath()) > 0\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>len</string>
<string>_getattr_</string>
<string>context</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>Alarm_senseProductVersion</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Here we make sure the all required system libraries are installed in\n
appropriate version.\n
"""\n
# Verify if upgrade is required for Python\n
if len(context.ERP5Site_upgradePythonExecutable()) > 0:\n
return True\n
\n
# Verify if uprgade is required for Zope\n
if len(context.ERP5Site_upgradeSoftwareHome()) > 0:\n
return True\n
\n
return False\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>len</string>
<string>_getattr_</string>
<string>context</string>
<string>True</string>
<string>False</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>Alarm_senseSystemVersion</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
This script is used in an alarm that acts as a cron job.\n
It will start an instance upgrade if any of the following alarms:\n
- bt5_upgrader (supported)\n
- product_upgrader (supported)\n
- system_upgrader (supported)\n
\n
"sense" a need of an upgrade. This alarm is likely to disappear soon as it\'s needed \n
due to lack of functionality (which is that alarms can not automatically "solve" themselves).\n
"""\n
context.ERP5Site_setupUpgraderSkinSelection()\n
\n
portal_alarms = context.getPortalObject().portal_alarms\n
activate = context.portal_activities.activate\n
previous_tag = None\n
\n
# XXX get the last activate process if exists\n
active_process = context.getLastActiveProcess()\n
if active_process is None or ((DateTime() - active_process.getStartDate()) > 1):\n
active_process = context.newActiveProcess()\n
\n
active_process = active_process.getPath()\n
\n
def launchUpgraderAlarm(alarm_id, after_method_id=[]):\n
"""\n
Get the alarm and use sense and solve\n
"""\n
upgrader_alarm = getattr(portal_alarms, alarm_id, None)\n
if upgrader_alarm is not None and upgrader_alarm.sense():\n
# call solve method\n
activate(active_process=active_process,\n
activity=\'SQLQueue\', \n
priority=2).Alarm_saveActiveResult(\n
summary=upgrader_alarm.getTitle(), \n
severity=0, \n
detail="Upgrade Required for %s" % \\\n
(upgrader_alarm.getTitle()))\n
\n
kw = dict(tag=alarm_id)\n
if len(after_method_id) > 0:\n
kw["after_method_id"] = after_method_id\n
# alarm.solve() dos not support activate parameters\n
# so it is not possible to use it directly.\n
method_id = upgrader_alarm.getSolveMethodId()\n
if method_id not in (None, \'\'):\n
method = getattr(upgrader_alarm.activate(**kw), method_id)\n
method()\n
return [ method_id ]\n
return after_method_id\n
\n
# There is one strict order to run the alarms\n
# This is required because the one alarms depends the previous one be\n
# Fully done.\n
previous_method_id = launchUpgraderAlarm(\'system_upgrader\')\n
previous_method_id = launchUpgraderAlarm(\'product_upgrader\', \n
after_method_id = previous_method_id)\n
\n
\n
previous_method_id.extend(["ERP5Site_restartZopeInstance",\n
"ERP5Site_clearActivities"])\n
\n
previous_method_id = launchUpgraderAlarm(\'bt5_upgrader\', \n
after_method_id = previous_method_id)\n
\n
previous_method_id.extend([\'updateBusinessTemplateFromUrl\',\n
\'TemplateTool_reinstallBT5\',\n
\'immediateReindexObject\'])\n
\n
previous_method_id = launchUpgraderAlarm(\'finalize_upgrader\',\n
after_method_id = previous_method_id)\n
\n
for alarm_id in [\'system_upgrader\', \'product_upgrader\', \n
\'bt5_upgrader\' , \'finalize_upgrader\']:\n
\n
upgrader_alarm = getattr(portal_alarms, alarm_id, None)\n
if upgrader_alarm is not None and upgrader_alarm.sense():\n
# Upgrade still needed for part.\n
#return\n
# XXX Do not retry run upgrader again, this is cause too much\n
# noise during this stage of development.\n
pass\n
\n
# Nothing else to do, so we can disable.\n
context.setEnabled(False)\n
return\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>_getattr_</string>
<string>context</string>
<string>portal_alarms</string>
<string>activate</string>
<string>None</string>
<string>previous_tag</string>
<string>active_process</string>
<string>DateTime</string>
<string>launchUpgraderAlarm</string>
<string>previous_method_id</string>
<string>_getiter_</string>
<string>alarm_id</string>
<string>getattr</string>
<string>upgrader_alarm</string>
<string>False</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>Alarm_senseUpgradeNeed</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
This script explains how to upgrade bt5. This script only update\n
the business templates, nothing else. Any other post script should\n
be handle by finalize upgrader.\n
"""\n
# Setup skins\n
context.ERP5Site_setupUpgraderSkinSelection()\n
\n
portal_alarms = context.getPortalObject().portal_alarms\n
activate = context.portal_activities.activate\n
# Group Messages into the same active process.\n
active_process = portal_alarms.upgrader_controller.getLastActiveProcess()\n
if active_process is None:\n
active_process = context.newActiveProcess()\n
\n
active_process = active_process.getPath()\n
\n
message_list = []\n
\n
system_upgrader_sense = portal_alarms.system_upgrader.sense()\n
product_upgrader_sense = portal_alarms.product_upgrader.sense()\n
\n
if system_upgrader_sense and product_upgrader_sense:\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=2).Alarm_saveActiveResult(\n
summary="ERROR: Upgrade BT5 not started",\n
severity=0,\n
detail=\'System Upgrader Sense: %s , Product Upgrader Sense : %s\' \\\n
% ( system_upgrader_sense, product_upgrader_sense))\n
\n
# update existing bt5\n
message_list.extend(context.ERP5Site_upgradeBusinessTemplateList(upgrade=1))\n
\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=2).Alarm_saveActiveResult(summary="Upgrade BT5 Version",\n
severity=0,\n
detail=\'\\n\'.join(message_list))\n
\n
return message_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>context</string>
<string>portal_alarms</string>
<string>activate</string>
<string>active_process</string>
<string>None</string>
<string>message_list</string>
<string>system_upgrader_sense</string>
<string>product_upgrader_sense</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>Alarm_upgradeBT5Version</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Finalize Upgrade is the final step of upgrader. Here should contains\n
the scripts that should be executed after the business template installation.\n
"""\n
# Setup skins\n
context.ERP5Site_setupUpgraderSkinSelection()\n
\n
clear_cache_kw = dict(activity=\'SQLQueue\', \n
priority=3, \n
tag="tag_upgrader_clear_cache")\n
\n
portal_alarms = context.getPortalObject().portal_alarms\n
activate = context.portal_activities.activate\n
# Group Messages into the same active process.\n
active_process = portal_alarms.upgrader_controller.getLastActiveProcess()\n
if active_process is None:\n
active_process = context.newActiveProcess()\n
\n
active_process = active_process.getPath()\n
\n
message_list = []\n
bt5_upgrader_sense = portal_alarms.bt5_upgrader.sense()\n
if bt5_upgrader_sense:\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=2).Alarm_saveActiveResult(\n
summary="ERROR: Finalize Upgrader not started",\n
severity=0,\n
detail=\'BT5 Upgrader Sense: %s\' % (bt5_upgrader_sense))\n
\n
# Verify if is required upgrade Global Site Properties. \n
message_list.extend(context.ERP5Site_upgradeGlobalPropertyList(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeWorkflowChain(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeValidationStateList(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeData(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradePortalTypePropertySheet(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeSecurity(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeMySQLCharset(upgrade=1))\n
\n
message_list.extend(context.ERP5Site_upgradeSQLCatalogFilter(upgrade=1))\n
\n
# Verify if there was any change previously and \n
if len(message_list) > 0:\n
message_list.extend(context.ERP5Site_upgradeSQLCatalog(upgrade=1))\n
clear_cache_kw[\'after_tag\'] = \'tag_migration_finish\'\n
\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=2).Alarm_saveActiveResult(summary="Finalize Upgrade",\n
severity=0,\n
detail=\'\\n\'.join(message_list))\n
\n
clear_cache_kw[\'after_method_id\'] = [\'Alarm_saveActiveResult\',\'immediateReindexObject\']\n
context.portal_caches.activate(**clear_cache_kw).clearAllCache()\n
\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=4,\n
after_tag=clear_cache_kw[\'tag\']).ERP5Site_notifyUpgradeIntegrity(active_process=active_process)\n
\n
return message_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>context</string>
<string>dict</string>
<string>clear_cache_kw</string>
<string>portal_alarms</string>
<string>activate</string>
<string>active_process</string>
<string>None</string>
<string>message_list</string>
<string>bt5_upgrader_sense</string>
<string>len</string>
<string>_write_</string>
<string>_apply_</string>
<string>_getitem_</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>Alarm_upgradeFinalize</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Upgrade product path to the release version of this upgrader\n
"""\n
\n
portal_alarms = context.getPortalObject().portal_alarms\n
activate = context.portal_activities.activate\n
\n
# Group Messages into the same active process.\n
active_process = portal_alarms.upgrader_controller.getLastActiveProcess()\n
if active_process is None:\n
active_process = context.newActiveProcess()\n
\n
active_process = active_process.getPath()\n
\n
message_list = []\n
message_list.extend(context.ERP5Site_upgradeProductPath(upgrade=1))\n
\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=2).Alarm_saveActiveResult(\n
summary="Upgrade Products Version",\n
severity=0,\n
detail=\'\\n\'.join(message_list))\n
\n
# Only restart if products were upgraded. Otherwise ignore restart.\n
if len(message_list) > 0:\n
# We don\'t want to restart the server during the tests or some cases\n
# we can post done the restart.\n
activate(activite_process=active_process,\n
activity=\'SQLQueue\',\n
priority=5).ERP5Site_restartZopeInstance()\n
\n
activate(activity=\'SQLQueue\',\n
tag=\'update_product_tag\', \n
after_method_id=\'ERP5Site_restartZopeInstance\' \n
).ERP5Site_verifyProductPathUpgrade()\n
\n
activate(activity=\'SQLQueue\',\n
after_tag = \'update_product_tag\', \n
priority=0).ERP5Site_clearActivities()\n
\n
return message_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>context</string>
<string>portal_alarms</string>
<string>activate</string>
<string>active_process</string>
<string>None</string>
<string>message_list</string>
<string>len</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>Alarm_upgradeProductVersion</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
We do not upgrade the system from the upgrader.\n
"""\n
\n
portal_alarms = context.getPortalObject().portal_alarms\n
activate = context.portal_activities.activate\n
# Group Messages into the same active process.\n
active_process = portal_alarms.upgrader_controller.getLastActiveProcess()\n
if active_process is None:\n
active_process = context.newActiveProcess().getPath()\n
\n
active_process = active_process.getPath()\n
\n
message_list = []\n
# Upgrade Software Home\n
message_list.extend(context.ERP5Site_upgradeSoftwareHome(upgrade=1))\n
\n
# Upgrade Python Executable\n
message_list.extend(context.ERP5Site_upgradePythonExecutable(upgrade=1))\n
\n
activate(active_process=active_process,\n
activity=\'SQLQueue\',\n
priority=2).Alarm_saveActiveResult(\n
summary="Upgrade System Version",\n
severity=0,\n
detail=\'\\n---\\n\'.join(message_list))\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>_getattr_</string>
<string>context</string>
<string>portal_alarms</string>
<string>activate</string>
<string>active_process</string>
<string>None</string>
<string>message_list</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>Alarm_upgradeSystemVersion</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_clearActivities</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_clearActivities</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_editERP5SiteProperty</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_editERP5SiteProperty</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Site\'s version is the version of the erp5_core business template\n
This script could be moved to should use System Signature or \n
simple replaced by:\n
portal_instropections.getSystemSignature()["business_templates"]\n
"""\n
bt5 = context.getPortalObject().portal_templates.getInstalledBusinessTemplate("erp5_core")\n
return str(bt5.getVersion())\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>_getattr_</string>
<string>context</string>
<string>bt5</string>
<string>str</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>ERP5Site_getBusinessTemplateVersion</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>database = context.erp5_sql_connection.connection_string.split(\' \')[0]\n
database_name = database.split("@")[0]\n
\n
alter_table_str = "ALTER TABLE %s CHARSET=%s;"\n
alter_database_str = "ALTER DATABASE %s %s=%s;"\n
default_encode = \'utf8\'\n
\n
sql_list = []\n
\n
database_set_list = [\'CHARSET\']\n
\n
table_set_list = [\'catalog\',\'alarm\',\'catalog\',\'category\',\'delivery\',\'email\',\n
\'full_text\',\'inventory\',\'inventory_stock\',\'item\',\'measure\',\n
\'message\',\'message_queue\',\'movement\',\'portal_ids\',\'predicate\',\n
\'predicate_category\',\'record\',\'roles_and_users\',\'stock\',\n
\'subject\',\'translation\',\'versioning\']\n
\n
for data_set in database_set_list:\n
sql_list.append(alter_database_str % (database_name, data_set, default_encode))\n
\n
sql_list.append("USE %s;" % database_name)\n
\n
for table_set in table_set_list:\n
sql_list.append(alter_table_str % (table_set, default_encode))\n
\n
return \'\\n\'.join(sql_list)\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>database</string>
<string>database_name</string>
<string>alter_table_str</string>
<string>alter_database_str</string>
<string>default_encode</string>
<string>sql_list</string>
<string>database_set_list</string>
<string>table_set_list</string>
<string>_getiter_</string>
<string>data_set</string>
<string>table_set</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>ERP5Site_getUpgradeCatalogCharsetSQL</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
The release signature is a kind of declarative\n
specification of an upgrader.\n
"""\n
# The destination release provided by this upgrader\n
DESTINATION_RELEASE = \'5.4.6\'\n
\n
ZOPE_VERSION = "2.8.11"\n
\n
PYTHON_VERSION = "2.4.6"\n
\n
# The list of URLs to get bt5 from\n
# NOTE: we expect the system buildout to be able\n
# to get everything we need from SVN and copy it\n
# to /srv/share/RELEASE/bt5/\n
# Some people may prefer to download stuff from the web\n
# but this is not the way we are going since we recommend\n
# the use of a standard buildout to create the filesystem\n
# hierarchy\n
# XXX-Luke: See bug #1503 - this variable is very hard to be used in Upgrader\n
# tests.\n
BT5_URL_BASE_LIST = ( \'file:///srv/share/bt5/%s\' % DESTINATION_RELEASE ,\n
\'http://www.erp5.org/dists/release/%s/bt5/\' % DESTINATION_RELEASE,\n
# XXX Use snapshot folder to test upgrade to HEAD\n
\'http://www.erp5.org/dists/snapshot/bt5/\',\n
\'file:///srv/share/bt5/upgrade\',\n
# INSTANCE_HOME_REPOSITORY represents $INSTANCE_HOME/bt5 \n
# It is not possible get the instance home into ZODB easily,\n
# so the detection script find the appropriate repository \n
# for the Business Templates.\n
\'INSTANCE_HOME_REPOSITORY\' ,\n
)\n
\n
if getattr(context, "ERP5Site_getBT5UrlBaseList", None) is not None:\n
# XXX This script should be present when it is required custom places for\n
# run upgrade (ie.: unit tests)\n
BT5_URL_BASE_LIST = context.ERP5Site_getBT5UrlBaseList()\n
\n
\n
# A list of bt5 which the upgrader can upgrade\n
# ie. a bt5 not in this list will not be upgraded\n
# by having an explicit list we can handle dedicate\n
# and we can allow people to create some developer mode\n
# stuff which they can control\n
UPGRADABLE_BT5_ID_LIST = (\n
"erp5_l10n_fr",\n
"erp5_l10n_ja",\n
"erp5_l10n_ko",\n
"erp5_l10n_pl_PL",\n
"erp5_l10n_pt-BR",\n
"erp5_accounting_l10n_ifrs",\n
"erp5_accounting_l10n_fr", \n
"erp5_accounting_l10n_sn",\n
# Update some bt5 not from default\n
# But it can be present\n
"erp5_mobile",\n
"erp5_ui_test_core",\n
"erp5_ui_test",\n
"erp5_express_ui_test",\n
)\n
\n
# A list bt5 which are required for the upgrade\n
# ie. the upgrader will install them even\n
# if they are not already installed\n
REQUIRED_BT5_ID_LIST = ("erp5_core",\n
"erp5_mysql_innodb_catalog",\n
"erp5_xhtml_style",\n
"erp5_knowledge_pad",\n
"erp5_base",\n
"erp5_wizard",\n
"erp5_odt_style",\n
"erp5_ods_style",\n
"erp5_ingestion_mysql_innodb_catalog",\n
"erp5_ingestion",\n
"erp5_crm",\n
"erp5_web",\n
"erp5_dms",\n
"erp5_pdm",\n
"erp5_trade",\n
"erp5_accounting",\n
"erp5_invoicing",\n
"erp5_simplified_invoicing",\n
"tiolive_base",\n
"erp5_tax_resource",\n
"erp5_discount_resource",\n
"erp5_legacy_tax_system",\n
"erp5_ooo_import",\n
"express_customisation",\n
)\n
\n
# Call some scripts inside same transaction before or after BT update\n
BEFORE_TRIGGERED_BT5_SCRIPT_ID_DICT = {}\n
AFTER_TRIGGERED_BT5_SCRIPT_ID_DICT = {\'erp5_mysql_innodb_catalog\': (\'ERP5Site_updateSitePropertyForTestOnly\',)}\n
\n
# A list bt5 which require reinstallation\n
# ie. the upgrader will call reinstall\n
# on each of them and revert all local changes.\n
REINSTALABLE_BT5_ID_LIST = (\'erp5_odt_style\',\n
)\n
\n
# A snapshot of workflow chains which are known to be valid\n
# this snapshot will be generated automatically from release\n
# document in the future.\n
#\n
# chains are exhaustive: they may contain more workflows that\n
# installed workflows in a system (which is not perfect for\n
# example in the case of -chains in bt5)\n
\n
# XXX It is only for test proprose now.\n
WORKFLOW_CHAIN_DICT = {\'chain_Account\': \'edit_workflow, account_workflow\',\n
\'chain_Accounting Period\': \'edit_workflow, accounting_period_workflow\',\n
\'chain_Accounting Transaction\': \'accounting_workflow, edit_workflow\',\n
\'chain_Accounting Transaction Line\': \'delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow, edit_workflow\',\n
\'chain_Acknowledgement\': \'acknowledgement_workflow\',\n
\'chain_Action Information\': \'base_type_interaction_workflow\',\n
\'chain_Address\': \'edit_workflow\',\n
\'chain_Agent\': \'edit_workflow\',\n
\'chain_Assignment\': \'edit_workflow, assignment_workflow\',\n
\'chain_Balance Transaction\': \'edit_workflow, accounting_workflow\',\n
\'chain_Bank Account\': \'validation_workflow, edit_workflow\',\n
\'chain_Base Category\': \'category_publication_workflow, edit_workflow\',\n
\'chain_Base Type\': \'base_type_interaction_workflow\',\n
\'chain_Business Path\': \'edit_workflow\',\n
\'chain_Business Process\': \'edit_workflow, validation_workflow\',\n
\'chain_Business State\': \'edit_workflow\',\n
\'chain_Business Template\': \'business_template_building_workflow, business_template_installation_workflow\',\n
\'chain_Campaign\': \'edit_workflow, pricing_interaction_workflow, ticket_workflow, ticket_interaction_workflow\',\n
\'chain_Career\': \'career_workflow\',\n
\'chain_Cash Register\': \'validation_workflow, edit_workflow\',\n
\'chain_Category\': \'category_publication_workflow, edit_workflow\',\n
\'chain_Category Divergence Tester\': \'edit_workflow\',\n
\'chain_Chat Address\': \'edit_workflow\',\n
\'chain_Component\': \'validation_workflow, edit_workflow\',\n
\'chain_Container\': \'edit_workflow, pricing_interaction_workflow\',\n
\'chain_Container Cell\': \'container_interaction_workflow, pricing_interaction_workflow, edit_workflow\',\n
\'chain_Container Line\': \'edit_workflow, trade_matrix_workflow, container_interaction_workflow, pricing_interaction_workflow\',\n
\'chain_Credit Card\': \'edit_workflow, validation_workflow\',\n
\'chain_Currency\': \'validation_workflow, edit_workflow\',\n
\'chain_Currency Exchange Line\': \'validation_workflow, currency_exchange_line_interaction_workflow, edit_workflow\',\n
\'chain_Delivery Cell\': \'delivery_movement_simulation_interaction_workflow, delivery_movement_causality_interaction_workflow\',\n
\'chain_Delivery Rule\': \'rule_validation_workflow, edit_workflow\',\n
\'chain_Discount\': \'edit_workflow, validation_workflow\',\n
\'chain_Distributed Ram Cache\': \'distributed_ram_cache_interaction_workflow\',\n
\'chain_Document\': \'edit_workflow\',\n
\'chain_Document Ingestion Message\': \'document_ingestion_interaction_workflow, document_ingestion_workflow, edit_workflow\',\n
\'chain_Drawing\': \'edit_workflow, local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow, document_publication_workflow\',\n
\'chain_Email\': \'edit_workflow\',\n
\'chain_Fax\': \'edit_workflow\',\n
\'chain_Fax Message\': \'edit_workflow, event_interaction_workflow, event_workflow, pricing_interaction_workflow\',\n
\'chain_File\': \'edit_workflow, local_permission_interaction_workflow, processing_status_workflow, document_publication_workflow, document_interaction_workflow\',\n
\'chain_Gadget\': \'edit_workflow, knowledge_pad_validation_workflow\',\n
\'chain_Image\': \'edit_workflow, local_permission_interaction_workflow, processing_status_workflow, document_publication_workflow, document_interaction_workflow\',\n
\'chain_Internal Packing List\': \'packing_list_workflow, edit_workflow, delivery_causality_workflow, delivery_causality_interaction_workflow, delivery_simulation_interaction_workflow\',\n
\'chain_Internal Packing List Cell\': \'delivery_movement_simulation_interaction_workflow, pricing_interaction_workflow, delivery_movement_causality_interaction_workflow\',\n
\'chain_Internal Packing List Line\': \'delivery_movement_causality_interaction_workflow, edit_workflow, trade_matrix_workflow, pricing_interaction_workflow, delivery_movement_simulation_interaction_workflow, movement_base_contribution_interaction_workflow\',\n
\'chain_Internal Supply\': \'edit_workflow, validation_workflow\',\n
\'chain_Internal Supply Line\': \'edit_workflow, supply_line_interaction_workflow\',\n
\'chain_Inventory\': \'inventory_workflow, edit_workflow\',\n
\'chain_Inventory Cell\': \'pricing_interaction_workflow\',\n
\'chain_Inventory Line\': \'trade_matrix_workflow, pricing_interaction_workflow, edit_workflow\',\n
\'chain_Invoice Cell\': \'pricing_interaction_workflow, delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow, tax_interaction_workflow, edit_workflow\',\n
\'chain_Invoice Line\': \'delivery_movement_simulation_interaction_workflow, pricing_interaction_workflow, tax_interaction_workflow, trade_matrix_workflow, delivery_movement_causality_interaction_workflow, edit_workflow, movement_base_contribution_interaction_workflow\',\n
\'chain_Invoice Rule\': \'edit_workflow, rule_validation_workflow\',\n
\'chain_Invoice Transaction Rule\': \'edit_workflow, rule_interaction_workflow, rule_validation_workflow\',\n
\'chain_Invoicing Rule\': \'edit_workflow, rule_validation_workflow\',\n
\'chain_Knowledge Box\': \'edit_workflow, knowledge_pad_validation_workflow\',\n
\'chain_Knowledge Pad\': \'edit_workflow, knowledge_pad_validation_workflow\',\n
\'chain_Letter\': \'event_interaction_workflow, edit_workflow, pricing_interaction_workflow, event_workflow\',\n
\'chain_Link\': \'edit_workflow\',\n
\'chain_Mail Message\': \'edit_workflow, pricing_interaction_workflow, event_workflow, event_interaction_workflow\',\n
\'chain_Mapped Value\': \'edit_workflow\',\n
\'chain_Measure\': \'edit_workflow, measure_interaction_workflow\',\n
\'chain_Meeting\': \'pricing_interaction_workflow, edit_workflow, ticket_workflow, ticket_interaction_workflow\',\n
\'chain_Memcached Plugin\': \'memcached_plugin_interaction_workflow\',\n
\'chain_Note\': \'event_workflow, edit_workflow, pricing_interaction_workflow, event_interaction_workflow\',\n
\'chain_Notification Message\': \'edit_workflow, notification_message_workflow\',\n
\'chain_Order Rule\': \'edit_workflow, rule_validation_workflow\',\n
\'chain_Organisation\': \'edit_workflow, validation_workflow\',\n
\'chain_PDF\': \'edit_workflow, local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow, document_publication_workflow\',\n
\'chain_Payment Condition\': \'edit_workflow\',\n
\'chain_Payment Rule\': \'edit_workflow, rule_validation_workflow\',\n
\'chain_Payment Transaction\': \'edit_workflow, accounting_workflow\',\n
\'chain_Person\': \'validation_workflow, edit_workflow, user_account_workflow, local_permission_interaction_workflow, person_interaction_workflow, express_person_interaction_workflow\',\n
\n
\'chain_Phone Call\': \'event_interaction_workflow, event_workflow, pricing_interaction_workflow, edit_workflow\',\n
\'chain_Predicate\': \'rule_interaction_workflow\',\n
\'chain_Preference\': \'preference_workflow\',\n
\'chain_Presentation\': \'edit_workflow, document_publication_workflow, local_permission_interaction_workflow, processing_status_workflow, document_interaction_workflow\',\n
\'chain_Product\': \'validation_workflow, edit_workflow\',\n
\'chain_Property Divergence Tester\': \'edit_workflow\',\n
\'chain_Purchase Invoice Transaction\': \'delivery_simulation_interaction_workflow, delivery_causality_interaction_workflow, edit_workflow, accounting_workflow, delivery_tax_interaction_workflow, delivery_causality_workflow\',\n
\'chain_Purchase Invoice Transaction Line\': \'edit_workflow, delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow\',\n
\'chain_Purchase Order\': \'edit_workflow, order_workflow, order_simulation_interaction_workflow, delivery_tax_interaction_workflow\',\n
\'chain_Purchase Order Cell\': \'edit_workflow, pricing_interaction_workflow, tax_interaction_workflow, order_movement_simulation_interaction_workflow\',\n
\'chain_Purchase Order Line\': \'order_movement_simulation_interaction_workflow, edit_workflow, trade_matrix_workflow, pricing_interaction_workflow, tax_interaction_workflow, movement_base_contribution_interaction_workflow\',\n
\'chain_Purchase Packing List\': \'edit_workflow, delivery_simulation_interaction_workflow, packing_list_workflow, delivery_causality_interaction_workflow, delivery_causality_workflow\',\n
\'chain_Purchase Packing List Cell\': \'pricing_interaction_workflow, delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow\',\n
\'chain_Purchase Packing List Line\': \'edit_workflow, pricing_interaction_workflow, delivery_movement_causality_interaction_workflow, trade_matrix_workflow, delivery_movement_simulation_interaction_workflow, movement_base_contribution_interaction_workflow\',\n
\'chain_Purchase Supply\': \'edit_workflow, validation_workflow\',\n
\'chain_Purchase Supply Line\': \'edit_workflow, supply_line_interaction_workflow\',\n
\'chain_Purchase Trade Condition\': \'edit_workflow, validation_workflow\',\n
\'chain_Quantity Divergence Tester\': \'edit_workflow\',\n
\'chain_Query\': \'edit_workflow, query_workflow\',\n
\'chain_RSS Feed\': \'document_publication_workflow, edit_workflow, local_permission_interaction_workflow\',\n
\'chain_Returned Sale Packing List\': \'delivery_causality_workflow, edit_workflow, packing_list_workflow, delivery_causality_workflow\',\n
\'chain_Returned Sale Packing List Cell\': \'pricing_interaction_workflow\',\n
\'chain_Returned Sale Packing List Line\': \'pricing_interaction_workflow, trade_matrix_workflow\',\n
\'chain_Role Definition\': \'local_permission_interaction_workflow, edit_workflow\',\n
\'chain_Rounding Model\': \'validation_workflow\',\n
\'chain_Sale Invoice Transaction\': \'delivery_simulation_interaction_workflow, delivery_causality_interaction_workflow, edit_workflow, accounting_workflow, delivery_tax_interaction_workflow, delivery_causality_workflow\',\n
\'chain_Sale Invoice Transaction Line\': \'edit_workflow, delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow\',\n
\'chain_Sale Opportunity\': \'pricing_interaction_workflow, ticket_interaction_workflow, sale_opportunity_workflow, edit_workflow\',\n
\'chain_Sale Order\': \'edit_workflow, order_workflow, order_simulation_interaction_workflow, delivery_tax_interaction_workflow\',\n
\'chain_Sale Order Cell\': \'edit_workflow, pricing_interaction_workflow, tax_interaction_workflow, order_movement_simulation_interaction_workflow\',\n
\'chain_Sale Order Line\': \'order_movement_simulation_interaction_workflow, edit_workflow, trade_matrix_workflow, pricing_interaction_workflow, tax_interaction_workflow, movement_base_contribution_interaction_workflow\',\n
\'chain_Sale Packing List\': \'edit_workflow, packing_list_workflow, delivery_causality_interaction_workflow, delivery_simulation_interaction_workflow, delivery_causality_workflow, packing_list_container_workflow\',\n
\'chain_Sale Packing List Cell\': \'pricing_interaction_workflow, delivery_movement_simulation_interaction_workflow, container_interaction_workflow, delivery_movement_causality_interaction_workflow\',\n
\'chain_Sale Packing List Line\': \'edit_workflow, pricing_interaction_workflow, container_interaction_workflow, trade_matrix_workflow, delivery_movement_causality_interaction_workflow, delivery_movement_simulation_interaction_workflow, movement_base_contribution_interaction_workflow\',\n
\'chain_Sale Supply\': \'edit_workflow, validation_workflow\',\n
\'chain_Sale Supply Line\': \'edit_workflow, supply_line_interaction_workflow\',\n
\'chain_Sale Trade Condition\': \'edit_workflow, validation_workflow\',\n
\'chain_Service\': \'validation_workflow, edit_workflow\',\n
\'chain_Simulation Movement\': \'simulation_movement_causality_interaction_workflow\',\n
\'chain_Site Message\': \'edit_workflow, event_interaction_workflow, event_workflow\',\n
\'chain_Spreadsheet\': \'edit_workflow, document_interaction_workflow, processing_status_workflow, document_publication_workflow, local_permission_interaction_workflow\',\n
\'chain_Supply Line\': \'supply_line_interaction_workflow, edit_workflow\',\n
\'chain_Support Request\': \'edit_workflow, pricing_interaction_workflow, ticket_interaction_workflow, ticket_workflow\',\n
\'chain_System Preference\': \'preference_workflow\',\n
\'chain_Tax\': \'edit_workflow, validation_workflow\',\n
\'chain_Tax Rule\': \'edit_workflow, rule_validation_workflow\',\n
\'chain_Telephone\': \'edit_workflow\',\n
\'chain_Text\': \'edit_workflow, processing_status_workflow, local_permission_interaction_workflow, document_publication_workflow, document_interaction_workflow\',\n
\'chain_Trade Model Line\': \'edit_workflow, trade_model_line_interaction_workflow\',\n
\'chain_Trade Model Rule\': \'edit_workflow, rule_validation_workflow\',\n
\'chain_Transformation\': \'edit_workflow, validation_workflow\',\n
\'chain_Transformation Operation\': \'edit_workflow\',\n
\'chain_Transformation Optional Resource\': \'edit_workflow\',\n
\'chain_Transformation Transformed Resource\': \'edit_workflow\',\n
\'chain_URL Crawler\': \'edit_workflow, document_publication_workflow, local_permission_interaction_workflow\',\n
\'chain_Visit\': \'event_interaction_workflow, pricing_interaction_workflow, event_workflow, edit_workflow\',\n
\'chain_Web Message\': \'pricing_interaction_workflow, event_interaction_workflow, event_workflow, edit_workflow\',\n
\'chain_Web Page\': \'local_permission_interaction_workflow, edit_workflow, document_publication_workflow, document_interaction_workflow\',\n
\'chain_Web Section\': \'category_publication_workflow, local_permission_interaction_workflow, edit_workflow\',\n
\'chain_Web Site\': \'local_permission_interaction_workflow, edit_workflow, category_publication_workflow\'}\n
\n
# Portal Type definition based on portal_types_roles_express.sxc\n
# Once this document changes this script should be immediately \n
# updated to include or fix any security change.\n
\n
# Portal Types to be updated using updateMappingDefinition.\n
UPDATE_ROLE_PORTAL_TYPE_LIST = [ \'Person Module\',\n
\'Organisation Module\',\n
\'Currency Module\',\n
\'Query Module\',\n
\'Event Module\',\n
\'Sale Opportunity Module\',\n
\'Support Request Module\',\n
\'Meeting Module\',\n
\'Campaign Module\',\n
\'Accounting Transaction Module\',\n
\'Account Module\',\n
\'Sale Trade Condition Module\',\n
\'Purchase Trade Condition Module\',\n
\'Sale Order Module\',\n
\'Purchase Order Module\',\n
\'Sale Packing List Module\',\n
\'Purchase Packing List Module\',\n
\'Inventory Module\',\n
\'Document Module\',\n
\'Image Module\',\n
\'Document Ingestion Module\',\n
\'Web Page Module\',\n
\'Component Module\',\n
\'Product Module\',\n
\'Service Module\',\n
\'Tax Module\',\n
\'Contribution Tool\',\n
\'Gadget Tool\',\n
\'Knowledge Pad Module\',\n
\'Person\',\n
\'Organisation\',\n
\'Currency\',\n
\'Query\',\n
\'Assignment\',\n
\'Fax Message\',\n
\'Web Message\',\n
\'Letter\',\n
\'Mail Message\',\n
\'Note\',\n
\'Visit\',\n
\'Phone Call\',\n
\'Sale Opportunity\',\n
\'Support Request\',\n
\'Meeting\',\n
\'Campaign\',\n
\'Account\',\n
\'Accounting Period\',\n
\'Balance Transaction\',\n
\'Sale Invoice Transaction\',\n
\'Purchase Invoice Transaction\',\n
\'Accounting Transaction\',\n
\'Payment Transaction\',\n
\'Bank Account\',\n
\'Cash Register\',\n
\'Credit Card\',\n
\'Drawing\',\n
\'PDF\',\n
\'Presentation\',\n
\'Spreadsheet\',\n
\'Text\',\n
\'Web Page\',\n
\'Wizard Tool\',\n
\'Component\',\n
\'Product\',\n
\'Service\',\n
\'Transformation\',\n
\'Transformation Operation\',\n
\'Transformation Optional Resource\',\n
\'Transformation Transformed Resource\',\n
\'Tax\',\n
\'Inventory\',\n
\'Purchase Order\',\n
\'Purchase Packing List\',\n
\'Purchase Trade Condition\',\n
\'Sale Order\',\n
\'Sale Packing List\',\n
\'Sale Trade Condition\',\n
\'Gadget\',\n
\'Knowledge Pad\',\n
\'Knowledge Box\' \n
]\n
\n
# A property sheet expected to found into a Portal Type List.\n
# Example: (\'TradeOrder\', ["Sale Packing List", "Purchase Packing List"]),\n
PORTAL_TYPE_PROPERTY_SHEET_LIST = []\n
\n
# items to keep even if marked by BT5 to \'Remove\'\n
KEEP_ORIGINAL_DICT = {\n
\'erp5_core\':(\'portal_preferences/default_site_preference\',\n
\'portal_categories/function\',\n
),\n
\n
\'erp5_trade\':(\'portal_workflow/delivery_tax_interaction_workflow\',\n
\'portal_workflow/tax_interaction_workflow\',\n
\'tax_module\',\n
\'discount_module\',\n
\'portal_types/Discount\',\n
\'portal_types/Discount Line\',\n
\'portal_types/Discount Model Line\',\n
\'portal_types/Discount Module\',\n
\'portal_types/Tax\',\n
\'portal_types/Tax Line\',\n
\'portal_types/Tax Model Line\',\n
\'portal_types/Tax Module\',),\n
\n
\'erp5_invoicing\':(\'portal_workflow/delivery_movement_account_interaction_workflow\',\n
),\n
\n
\'erp5_wizard\':(\'portal_preferences/erp5_express_default_customer_preference\',\n
),\n
\n
\'erp5_express_ui_test\':(\'portal_type_roles/Person Module\',\n
\'portal_type_roles/Person\',\n
\'portal_type_roles/Organisation Module\',\n
),\n
\n
}\n
\n
# Items which need validation at upgrade time\n
VALIDATION_DICT = {\n
\'erp5_base\':((\'portal_categories/group\', \'draft\', \'embed\'),\n
(\'portal_categories/site\', \'draft\', \'embed\'),\n
),\n
\n
\'erp5_knowledge_pad\': (# Make gadgets visible\n
(\'portal_gadgets/clock\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/erp5_advertisement\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/erp5_documentation\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/erp5_persons\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/erp5_rss\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/erp5_worklists\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/google_calendar\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/google_maps\', \'invisible\', \'visible\'),\n
(\'portal_gadgets/google_search\', \'invisible\', \'visible\'),\n
# Make gadgets published\n
(\'portal_gadgets/clock\', \'visible\', \'public\'),\n
(\'portal_gadgets/erp5_advertisement\', \'visible\', \'public\'),\n
(\'portal_gadgets/erp5_documentation\', \'visible\', \'public\'),\n
(\'portal_gadgets/erp5_persons\', \'visible\', \'public\'),\n
(\'portal_gadgets/erp5_rss\', \'visible\', \'public\'),\n
(\'portal_gadgets/erp5_worklists\', \'visible\', \'public\'),\n
(\'portal_gadgets/google_calendar\', \'visible\', \'public\'),\n
(\'portal_gadgets/google_maps\', \'visible\', \'public\'),\n
(\'portal_gadgets/google_search\', \'visible\', \'public\'),\n
), \n
\n
\'erp5_trade\':((\'portal_rules/default_order_rule\', \'draft\', \'validate\'),\n
(\'portal_rules/default_delivery_rule\', \'draft\', \'validate\'),\n
),\n
\'erp5_invoicing\':((\'portal_rules/default_invoice_transaction_rule\', \'draft\', \'validate\'),\n
(\'portal_rules/default_invoicing_rule\', \'draft\', \'validate\'),\n
(\'portal_rules/default_trade_model_rule\', \'validated\', \'invalidate\'),\n
),\n
}\n
\n
CATALOG_FILTER_DICT = { \n
\'z_catalog_item_list\' : \'python: here.providesIMovement()\',\n
\'z_catalog_predicate_category_list\': \'python: isPredicate\',\n
\'z_catalog_movement_category_list\': \'python: here.providesIMovement()\',\n
\'z_catalog_delivery_list\': \'python: isDelivery\',\n
\'z_catalog_alarm_list\': \'\',\n
\'z0_uncatalog_subject\': \'python: isDocument\',\n
\'z0_uncatalog_inventory\': \'python: isInventory\',\n
\'z_catalog_stock_list\': \'python: here.providesIMovement() and not isInventoryMovement\',\n
\'z0_uncatalog_versioning\': "python:getattr(here, \'getVersion\', None) is not None",\n
\'z_catalog_non_movement_category_list\': \'python: not here.providesIMovement()\',\n
\'z_catalog_email_list\': \'\',\n
\'z_catalog_subject_list\': \'python: isDocument\',\n
\'z_catalog_movement_list\': \'python: here.providesIMovement()\',\n
\'z_catalog_predicate_list\': \'python: isPredicate\',\n
\'z_catalog_measure_list\': \'python: here.getPortalType() in here.getPortalResourceTypeList()\',\n
\'z_catalog_versioning_list\': "python:getattr(here, \'getVersion\', None) is not None",\n
\'z0_uncatalog_email\': \'\',\n
\'z_catalog_quantity_unit_conversion_list\': \'python: here.getPortalType() in here.getPortalResourceTypeList()\',\n
\'z0_uncatalog_inventory_stock\': \'python: isInventoryMovement\'}\n
\n
INTEGRITY_VERIFICATION_SCRIPT_ID_LIST = (\'ERP5Site_verifyUpgradeIntegrity\',\n
\'ERP5Site_verifyBT5UpgradeIntegrity\',\n
\'ERP5Site_verifyUserAuthentificationIntegrity\',\n
\'ERP5Site_verifyMemcachedIntegrity\',\n
\'ERP5Site_verifySQLCatalogFilterIntegrity\',\n
\'ERP5Site_verifyActivityIntegrity\')\n
\n
ERP5_SITE_PROPERTY_DICT = {}\n
\n
\n
# Wrap everything into a dict\n
signature_dict = {\n
# Defines the default release for bt5\n
\'release\': DESTINATION_RELEASE\n
# Defines the default version for zope\n
, \'zope\': ZOPE_VERSION\n
# Defines the default version for python\n
, \'python\': PYTHON_VERSION\n
# Defines the default release for products\n
, \'product\': DESTINATION_RELEASE\n
# Defines the default location of bt5\n
, \'bt5_base_url_list\': BT5_URL_BASE_LIST\n
# Provides a snapshot of how workflow chains should be configured\n
, \'workflow_chain_dict\': WORKFLOW_CHAIN_DICT\n
# Provides a list of required bt5 (without which upgrader wont\'t work)\n
, \'required_bt5_id_list\': REQUIRED_BT5_ID_LIST\n
# Provides a list of bt5 which can be upgraded by the upgrader (if already installed)\n
, \'upgradable_bt5_id_list\': UPGRADABLE_BT5_ID_LIST\n
, \'before_triggered_bt5_id_dict\': BEFORE_TRIGGERED_BT5_SCRIPT_ID_DICT\n
, \'after_triggered_bt5_id_dict\': AFTER_TRIGGERED_BT5_SCRIPT_ID_DICT\n
# Provide a list of bt5 which require reinstallation\n
, \'reinstalable_bt5_id_list\': REINSTALABLE_BT5_ID_LIST\n
# Provides a list of bt5 path and items which must not be upgraded or deleted\n
, \'keep_original_dict\': KEEP_ORIGINAL_DICT\n
# Provides a list of bt5 path which require workflow action after upgrade\n
, \'validation_dict\': VALIDATION_DICT\n
# Provides a list of script ids that will be run after the upgrade to check the Instance Integrity\n
, \'integrity_verification_script_id_list\': INTEGRITY_VERIFICATION_SCRIPT_ID_LIST\n
# Provides a dict with expected catalog filter expressions\n
, \'catalog_filter_dict\': CATALOG_FILTER_DICT\n
# Provides a list of portal types to had rules updated.\n
, \'update_role_portal_type_list\': UPDATE_ROLE_PORTAL_TYPE_LIST\n
# Provide a list of Property Sheet Expected into a portal type list\n
, \'portal_type_property_sheet_list\' : PORTAL_TYPE_PROPERTY_SHEET_LIST\n
# Provide a list of Properties Expected at ERP5Site portal\n
, \'erp5_site_property_dict\' : ERP5_SITE_PROPERTY_DICT\n
}\n
\n
if item is not None:\n
return signature_dict.get(item)\n
else:\n
return signature_dict\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>item=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>1</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>item</string>
<string>DESTINATION_RELEASE</string>
<string>ZOPE_VERSION</string>
<string>PYTHON_VERSION</string>
<string>BT5_URL_BASE_LIST</string>
<string>getattr</string>
<string>context</string>
<string>None</string>
<string>_getattr_</string>
<string>UPGRADABLE_BT5_ID_LIST</string>
<string>REQUIRED_BT5_ID_LIST</string>
<string>BEFORE_TRIGGERED_BT5_SCRIPT_ID_DICT</string>
<string>AFTER_TRIGGERED_BT5_SCRIPT_ID_DICT</string>
<string>REINSTALABLE_BT5_ID_LIST</string>
<string>WORKFLOW_CHAIN_DICT</string>
<string>UPDATE_ROLE_PORTAL_TYPE_LIST</string>
<string>PORTAL_TYPE_PROPERTY_SHEET_LIST</string>
<string>KEEP_ORIGINAL_DICT</string>
<string>VALIDATION_DICT</string>
<string>CATALOG_FILTER_DICT</string>
<string>INTEGRITY_VERIFICATION_SCRIPT_ID_LIST</string>
<string>ERP5_SITE_PROPERTY_DICT</string>
<string>signature_dict</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_getUpgraderSignature</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
# This script is called at the end of reindex and Run \n
# the verification scripts for this migration \n
# \n
# In addition to verification script, this send the log of\n
# migration for each instance. So we can analize the result \n
# later. One event could be created into nexedi erp5 for \n
# each instance updated.\n
# \n
try:\n
result = context.ERP5Site_verifyInstanceIntegrity()\n
except:\n
# Make Sure that the email will be send and indicates which \n
# Instance fails to verify.\n
result = ["Verification Failed."]\n
if erp5_uid is None:\n
erp5_uid = getattr(context.getPortalObject(), "erp5_site_global_id", \'%s (%s)\' % (context.getPortalObject().getTitle(), context.getPortalObject().absolute_url()))\n
\n
body="""\n
Result for Upgrader Verification Script for %s Instance: \n
\n
\n
""" % (erp5_uid)\n
\n
status = "OK"\n
if len(result) > 0:\n
status = "Failed"\n
body += \' \\n\'.join(result)\n
else:\n
body += \'NO MESSAGE\'\n
\n
body += """\n
========= Upgrader Log ============\n
"""\n
\n
if active_process is not None:\n
process = context.restrictedTraverse(active_process)\n
if process is not None:\n
for active_result in process.getResultList():\n
body += """\n
%s\n
""" % (active_result.detail)\n
else:\n
body += "Fail to get log from activity result!"\n
\n
subject = "%s: Upgrade Result for %s" % (status, erp5_uid)\n
\n
kw = {\'body\': body,\n
\'erp5_uid\': erp5_uid,\n
\'subject\' : subject}\n
\n
# If the instance is well configured this will send a message\n
# to email_to_address or email_from_address. \n
context.portal_notifications.sendMessage(\n
sender=None,\n
recipient=[],\n
subject=subject,\n
message=body,\n
message_text_format=\'text/plain\',\n
notifier_list=(\'Mail Message\',),\n
store_as_event=False,\n
)\n
\n
return ["Notification is sent!"]\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>erp5_uid=None, active_process=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>2</int> </value>
</item>
<item>
<key> <string>co_varnames</string> </key>
<value>
<tuple>
<string>erp5_uid</string>
<string>active_process</string>
<string>_getattr_</string>
<string>context</string>
<string>result</string>
<string>None</string>
<string>getattr</string>
<string>body</string>
<string>status</string>
<string>len</string>
<string>_inplacevar_</string>
<string>process</string>
<string>_getiter_</string>
<string>active_result</string>
<string>subject</string>
<string>kw</string>
<string>False</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<none/>
<none/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_notifyUpgradeIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_restartZopeInstance</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_restartZopeInstance</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_runVerificationScript</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_runVerificationScript</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
First, change skin order based on introspection \n
of the current version which is installed\n
\n
XXX This configuration could be moved to upgrader signature\n
"""\n
\n
return True\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>True</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>ERP5Site_setupUpgraderSkinSelection</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>portal = context.getPortalObject()\n
portal.manage_addProperty(\'custom_property_without_meaning\', \'I was there\', \'string\')\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></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>_getattr_</string>
<string>context</string>
<string>portal</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>ERP5Site_updateSitePropertyForTestOnly</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Check installed business templates one \n
by one. If one of the business templates does not \n
use the latest release, then we need to migrate.\n
\n
NOTE: this means that if a system uses custom\n
business templates (ie. dedicate), upgrader \n
will for now fail.\n
"""\n
# Initialize variables\n
portal_templates = context.getPortalObject().portal_templates\n
signature = context.ERP5Site_getUpgraderSignature()\n
release = signature[\'release\']\n
is_upgradable = False\n
message_list = []\n
\n
# verify only core is enough for now. \n
template_version = context.ERP5Site_getBusinessTemplateVersion()\n
if template_version != release:\n
is_upgradable = True\n
\n
# No need to upgrade (system is up to date)\n
if not is_upgradable:\n
return message_list\n
\n
message_list.append(\\\n
"Upgrade Required for Business Templates, Expected: %s , Current: %s." \\\n
% (release, template_version))\n
\n
# Notify that Business Template requires upgrade\n
if not upgrade:\n
return message_list\n
\n
# update all public bt5s\n
previous_bt5_id = None\n
bt5_counter = 0\n
required_bt5_id_list = signature[\'required_bt5_id_list\']\n
upgradable_bt5_id_list = signature[\'upgradable_bt5_id_list\']\n
reinstalable_bt5_id_list = signature[\'reinstalable_bt5_id_list\']\n
before_triggered_bt5_id_dict = signature[\'before_triggered_bt5_id_dict\']\n
after_triggered_bt5_id_dict = signature[\'after_triggered_bt5_id_dict\']\n
\n
base_url_list = signature[\'bt5_base_url_list\']\n
installed_bt5_title_list = [o.getTitle() for o in portal_templates.getInstalledBusinessTemplateList()]\n
\n
bt5_counter = portal_templates.countFolder()[0][0]\n
\n
def installBT5(bt5_title, previous_bt5, bt5_counter):\n
bt5_id = "%s_%s_%s" % (bt5_counter, bt5_title, release)\n
# no need to update a bt5 if it\'s to be explicitly added later \n
bt5_url = portal_templates.getBusinessTemplateUrl(base_url_list, bt5_title)\n
if portal_templates.has_key(bt5_id):\n
raise ValueError, \'Business Template %s has already been imported\' % bt5_id\n
if bt5_url is None:\n
message_list.append("%s was ignored because was not possible found"\n
"the bt5 into the followed repositories: %s" % \\\n
(bt5_title, base_url_list) )\n
return previous_bt5\n
kw = dict(activity = "SQLQueue", tag = bt5_id)\n
if previous_bt5 is not None:\n
kw[\'after_tag\'] = previous_bt5\n
# We must make sure all documents from previous installations \n
# are already indexed (specially categories).\n
kw[\'after_method_id\'] = "immediateReindexObject"\n
update_catalog = portal_templates.TemplateTool_isUpdateCatalogRequired(bt5_title)\n
before_triggered_bt5_id_list = before_triggered_bt5_id_dict.get(bt5_title, ())\n
after_triggered_bt5_id_list = after_triggered_bt5_id_dict.get(bt5_title, ())\n
keep_original_list = signature[\'keep_original_dict\'].get(bt5_title, ())\n
portal_templates.activate(**kw).updateBusinessTemplateFromUrl(\n
bt5_url, id = bt5_id, \n
keep_original_list=keep_original_list,\n
before_triggered_bt5_id_list=before_triggered_bt5_id_list,\n
after_triggered_bt5_id_list=after_triggered_bt5_id_list,\n
update_catalog=update_catalog)\n
\n
previous_bt5_id = bt5_id\n
bt5_counter += 1\n
message_list.append("\\tUpdate %s as %s" % (bt5_url, bt5_id))\n
return bt5_id\n
\n
def reinstallBT5(bt5_title, previous_bt5, bt5_counter):\n
bt5_id = "%s_%s_%s" % (bt5_counter, bt5_title, release)\n
kw = dict(activity="SQLQueue", tag=bt5_id)\n
if previous_bt5 is not None:\n
kw[\'after_tag\'] = previous_bt5\n
# We must make sure all documents from previous installations \n
# are already indexed (specially categories).\n
kw[\'after_method_id\'] = "immediateReindexObject"\n
update_catalog = portal_templates.TemplateTool_isUpdateCatalogRequired(bt5_title)\n
portal_templates.activate(**kw).TemplateTool_reinstallBT5(\n
bt5_title,\n
update_catalog=update_catalog)\n
\n
previous_bt5_id = bt5_id\n
bt5_counter += 1\n
message_list.append("\\t%s Reinstalling" % (bt5_id))\n
return bt5_id\n
\n
previous_bt5 = None\n
for bt in upgradable_bt5_id_list:\n
if bt in installed_bt5_title_list:\n
bt5_counter += 1\n
bt_id = installBT5(bt, previous_bt5, bt5_counter)\n
previous_bt5 = bt_id\n
\n
for bt in required_bt5_id_list:\n
bt5_counter += 1\n
bt_id = installBT5(bt, previous_bt5, bt5_counter)\n
previous_bt5 = bt_id\n
\n
for bt in reinstalable_bt5_id_list:\n
bt5_counter += 1\n
bt_id = reinstallBT5(bt, previous_bt5, bt5_counter)\n
previous_bt5 = bt_id\n
\n
message_list.append("Upgrade Executed for Business Configuration using activities.")\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_templates</string>
<string>signature</string>
<string>_getitem_</string>
<string>release</string>
<string>False</string>
<string>is_upgradable</string>
<string>message_list</string>
<string>template_version</string>
<string>True</string>
<string>None</string>
<string>previous_bt5_id</string>
<string>bt5_counter</string>
<string>required_bt5_id_list</string>
<string>upgradable_bt5_id_list</string>
<string>reinstalable_bt5_id_list</string>
<string>before_triggered_bt5_id_dict</string>
<string>after_triggered_bt5_id_dict</string>
<string>base_url_list</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>o</string>
<string>installed_bt5_title_list</string>
<string>installBT5</string>
<string>reinstallBT5</string>
<string>previous_bt5</string>
<string>bt</string>
<string>_inplacevar_</string>
<string>bt_id</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeBusinessTemplateList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Place for add upgrade of Data or objects.\n
This can be changed to a alarm in future and it will \n
probably be constantly overwriten everytime that it \n
is needed in another folder.\n
"""\n
\n
# By default it is never need to do data upgrade.\n
return []\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=[]</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>upgrade</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<list/>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeData</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>portal = context.getPortalObject()\n
message_list = []\n
is_upgrade_required = 0\n
site_property_dict = portal.ERP5Site_getUpgraderSignature(\'erp5_site_property_dict\')\n
\n
for prop in site_property_dict:\n
if site_property_dict[prop] != getattr(portal,prop , None):\n
if not upgrade:\n
return ["Upgrade Required for Global Properties."]\n
is_upgrade_required = 1\n
break\n
\n
if is_upgrade_required:\n
for prop in site_property_dict:\n
portal.ERP5Site_editERP5SiteProperty(prop, site_property_dict[prop])\n
message_list.append("Upgrade Executed for Global Properties.")\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>message_list</string>
<string>is_upgrade_required</string>
<string>site_property_dict</string>
<string>_getiter_</string>
<string>prop</string>
<string>_getitem_</string>
<string>getattr</string>
<string>None</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeGlobalPropertyList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_upgradeMySQLCharset</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeMySQLCharset</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Verify if a Property Sheet is associated with the Portal Type.\n
"""\n
\n
message_list = []\n
\n
portal_type_property_sheet_list = context.ERP5Site_getUpgraderSignature("portal_type_property_sheet_list")\n
\n
for expected_property_sheet, portal_type_id_list in portal_type_property_sheet_list:\n
\n
portal_type_list = context.portal_types.searchFolder(id=portal_type_id_list)\n
portal_type_to_fix = []\n
\n
for pt in portal_type_list:\n
property_sheet_list = pt.getTypePropertySheetList()\n
if expected_property_sheet not in pt.getTypePropertySheetList():\n
message_list.append("%s doesn\'t has %s associated." % (pt.getId(), expected_property_sheet))\n
if upgrade:\n
property_sheet_list.append(expected_property_sheet)\n
pt.setTypePropertySheet(property_sheet_list)\n
message_list.append("Associate PropertySheet %s into Portal Type %s." % (expected_property_sheet,pt.getId()))\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>message_list</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_type_property_sheet_list</string>
<string>_getiter_</string>
<string>expected_property_sheet</string>
<string>portal_type_id_list</string>
<string>portal_type_list</string>
<string>portal_type_to_fix</string>
<string>pt</string>
<string>property_sheet_list</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradePortalTypePropertySheet</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Update Product Path in zope.conf\n
"""\n
\n
signature = context.ERP5Site_getUpgraderSignature()\n
product_version = context.portal_introspections.getSystemSignatureDict()[\'erp5\']\n
\n
if product_version == signature["release"]:\n
return []\n
\n
if not upgrade:\n
return ["Upgrade required for Products. Current: %s , Expect %s" % (\n
product_version, signature["release"]) ]\n
\n
context.portal_introspections.setProductPath(signature["release"])\n
\n
return ["Upgraded Product Path List to %s" % (signature["release"])]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getattr_</string>
<string>context</string>
<string>signature</string>
<string>_getitem_</string>
<string>product_version</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeProductPath</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Upgrade Python at zopectl\n
"""\n
\n
python_version = context.ERP5Site_getUpgraderSignature()["python"]\n
current_python = context.portal_introspections.getSystemSignatureDict()[\'python\']\n
\n
if current_python == python_version:\n
return []\n
\n
if not upgrade:\n
return ["Upgrade required for Python Current: %s , Expected %s" % (\n
current_python,\n
python_version)]\n
\n
# XXX This change is too specific to TioLive servers environment.\n
new_python_path = "/usr/bin/python2.4"\n
context.portal_introspections.setPythonExecutable(new_python_path)\n
\n
return ["Upgraded Python Executable python was changed to %s" % (new_python_path)]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>python_version</string>
<string>current_python</string>
<string>new_python_path</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradePythonExecutable</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Update SQLCatalog, this script update the catalog when it is needed.\n
Finalize Upgrade never make sense become True, because there is no\n
standard way to detect if the SQLUpgrade is needed. Reindexation should \n
be only a consequence of other script only.\n
"""\n
\n
if not upgrade:\n
# Never consider outdated.\n
return []\n
\n
# Could we consider always update this after some business templates\n
# was updated?\n
message_list = []\n
\n
if not upgrade:\n
# Upgrade Required\n
return [\'Upgrade required for SQLCatalog\']\n
\n
catalog = context.portal_catalog.getSQLCatalog()\n
\n
# clear the catalog\n
catalog.manage_catalogClear()\n
message_list.append("Catalog %s was Clear." % (catalog.getId()))\n
\n
tag = "tag_migration_finish"\n
# reindex the while site\n
context.getPortalObject().ERP5Site_reindexAll(final_activity_tag=tag)\n
message_list.append("Launched Reindex of ERP5.")\n
# update translation\n
context.getPortalObject().ERP5Site_updateTranslationTable()\n
message_list.append("Update Translation Table.")\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>message_list</string>
<string>_getattr_</string>
<string>context</string>
<string>catalog</string>
<string>tag</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeSQLCatalog</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>message_list = []\n
catalog = context.portal_catalog.erp5_mysql_innodb\n
\n
filter_dict = catalog.getFilterDict()\n
catalog_filter_dict = {}\n
for key in filter_dict:\n
catalog_filter_dict[key] = filter_dict[key][\'expression\']\n
\n
expect_expression_dict = context.ERP5Site_getUpgraderSignature(\'catalog_filter_dict\')\n
\n
# test if keys are the same\n
for key in expect_expression_dict:\n
if expect_expression_dict[key] != catalog_filter_dict[key]:\n
message_list.append("Wrong expression definition found at %s: %s (Expected) != %s (Found)" % (key, expect_expression_dict[key], catalog_filter_dict[key]))\n
\n
if not upgrade:\n
return message_list\n
\n
message_list = []\n
# test if keys are the same\n
for key in expect_expression_dict:\n
if expect_expression_dict[key] != catalog_filter_dict[key]:\n
message_list.append("Upgraded Catalog Filter Expression definition found at %s ." % (key))\n
catalog.setFilterExpression(key, expect_expression_dict[key])\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>message_list</string>
<string>_getattr_</string>
<string>context</string>
<string>catalog</string>
<string>filter_dict</string>
<string>catalog_filter_dict</string>
<string>_getiter_</string>
<string>key</string>
<string>_getitem_</string>
<string>_write_</string>
<string>expect_expression_dict</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeSQLCatalogFilter</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Place for add Security or Roles upgrade.\n
\n
There is tools and new modules added by upgrader\n
and those the roles should be updated. \n
\n
ie.: Make Web site available for old instances or\n
update local roles.\n
\n
"""\n
message_list = []\n
\n
# Currently is never needed to update security, it is always forced.\n
if not upgrade:\n
return message_list\n
\n
portal = context.getPortalObject()\n
portal_type_list = portal.ERP5Site_getUpgraderSignature("update_role_portal_type_list")\n
\n
for pt in portal_type_list:\n
portal_type_document = getattr(context.portal_types, pt, None )\n
if portal_type_document is not None:\n
portal_type_document.updateRoleMapping()\n
\n
message_list.append(\n
"Update Local Roles for security groups for: \\n\\t%s" % \\\n
(\'\\n\\t\'.join(portal_type_list)))\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>message_list</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>portal_type_list</string>
<string>_getiter_</string>
<string>pt</string>
<string>getattr</string>
<string>None</string>
<string>portal_type_document</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeSecurity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Update Software Home in zopectl\n
"""\n
zope_version = context.ERP5Site_getUpgraderSignature()["zope"]\n
current_zope_version = context.portal_introspections.getSystemSignatureDict()[\'zope\']\n
\n
if current_zope_version == zope_version:\n
return []\n
\n
if not upgrade:\n
return ["Upgrade required for Zope Current: %s , Expected %s" % (\n
current_zope_version, zope_version)]\n
\n
# XXX This change is too specific to TioLive servers environment.\n
context.portal_introspections.setSoftwareHome(zope_version)\n
\n
return ["Upgrade Sotware home to: %s" % zope_version ]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getitem_</string>
<string>_getattr_</string>
<string>context</string>
<string>zope_version</string>
<string>current_zope_version</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeSoftwareHome</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
It is expected that some objects has some state in the after upgrade finish.\n
This alarm verify and upgrade the objects that were defined in signature.\n
"""\n
portal_templates = context.portal_templates\n
signature = context.ERP5Site_getUpgraderSignature()\n
validation_dict = signature[ \'validation_dict\']\n
release = signature[\'release\']\n
upgrade = int(upgrade)\n
# get list of title of bt5 that are installed.\n
installed_bt5_title_list = [t.getTitle() for t in portal_templates.getInstalledBusinessTemplateList()]\n
\n
# get the list of keys that correspond to a valid business template.\n
upgradable_list = []\n
for k in validation_dict.keys():\n
if k in installed_bt5_title_list:\n
upgradable_list.extend(validation_dict[k])\n
\n
message_list = []\n
for definition in upgradable_list:\n
sub_message_list = []\n
path, expected_state, action = definition\n
obj = context.restrictedTraverse(path)\n
if obj is not None and \\\n
getattr(obj, \'getValidationState\', None) is not None and \\\n
obj.getValidationState() == expected_state:\n
\n
sub_message_list.append("Upgrade is required for Validation Workflow List (%s object is in %s state, action %s.)" %\n
(path, expected_state, action))\n
if upgrade == 1:\n
workflow_method = getattr(obj, action , None)\n
if workflow_method is not None:\n
workflow_method()\n
sub_message_list.append("updated")\n
message_list.append(\' \'.join(sub_message_list))\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getattr_</string>
<string>context</string>
<string>portal_templates</string>
<string>signature</string>
<string>_getitem_</string>
<string>validation_dict</string>
<string>release</string>
<string>int</string>
<string>append</string>
<string>$append0</string>
<string>_getiter_</string>
<string>t</string>
<string>installed_bt5_title_list</string>
<string>upgradable_list</string>
<string>k</string>
<string>message_list</string>
<string>definition</string>
<string>sub_message_list</string>
<string>path</string>
<string>expected_state</string>
<string>action</string>
<string>obj</string>
<string>None</string>
<string>getattr</string>
<string>workflow_method</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeValidationStateList</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
verify if the workflow was updated, if is not updated update it.\n
"""\n
workflow_chain_dict = context.ERP5Site_getUpgraderSignature(\'workflow_chain_dict\')\n
if workflow_chain_dict is None:\n
# If no signature, ignore.\n
return []\n
\n
chain = context.portal_workflow.getWorkflowChainDict()\n
if chain == workflow_chain_dict:\n
return []\n
\n
if int(upgrade) == 1:\n
context.portal_workflow.manage_changeWorkflows(default_chain = \'\',\n
props = workflow_chain_dict)\n
return ["Upgrade Executed for Workflow Chain."]\n
\n
return ["Upgrade Required for Workflow Chain."]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>upgrade=0</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>upgrade</string>
<string>_getattr_</string>
<string>context</string>
<string>workflow_chain_dict</string>
<string>None</string>
<string>chain</string>
<string>int</string>
</tuple>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>func_defaults</string> </key>
<value>
<tuple>
<int>0</int>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_upgradeWorkflowChain</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
"""\n
Verify if this instance is a properly configured one.\n
This script could be used in functional tests\n
"""\n
portal = context.getPortalObject()\n
\n
message_list = []\n
\n
activity_failure_list = context.portal_activities.getMessageList(processing_node=-2)\n
\n
if len(activity_failure_list) > 0:\n
message_list.append("Activity Failures was found (%s)." % (len(activity_failure_list),))\n
return message_list\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>message_list</string>
<string>activity_failure_list</string>
<string>len</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>ERP5Site_verifyActivityIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Verify if this instance is a properly configured one.\n
This script could be used in functional tests\n
"""\n
portal = context.getPortalObject()\n
message_list = []\n
\n
def assertEquals(value1, value2):\n
if value1 == value2:\n
return True\n
return False\n
\n
def assertNotEquals(value1, value2):\n
if value1 != value2:\n
return True\n
return False\n
\n
\n
# BT5 must contain a minimum set of installed ones having current ERP5 instance version\n
# Hardcoded Version from now.\n
signature = context.ERP5Site_getUpgraderSignature()\n
erp5_instance_version = signature[\'release\']\n
# XXX It should be generic at someday in future and use Signature Script.\n
\n
\n
minimum_bt5_title_list = list(signature[\'required_bt5_id_list\']) + \\\n
[\'express_customisation\']\n
\n
for bt5_title in minimum_bt5_title_list:\n
bt5 = portal.portal_templates.getInstalledBusinessTemplate(bt5_title)\n
if bt5 is not None:\n
if not assertEquals(bt5.getVersion(), erp5_instance_version):\n
message_list.append("False %s (%s != %s)" % (bt5_title, bt5.getVersion(), erp5_instance_version)) \n
else:\n
message_list.append("False (bt5 %s not found)" % (bt5_title))\n
\n
return [ i for i in message_list if i is not True]\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>message_list</string>
<string>assertEquals</string>
<string>assertNotEquals</string>
<string>signature</string>
<string>_getitem_</string>
<string>erp5_instance_version</string>
<string>list</string>
<string>minimum_bt5_title_list</string>
<string>_getiter_</string>
<string>bt5_title</string>
<string>bt5</string>
<string>None</string>
<string>append</string>
<string>$append0</string>
<string>i</string>
<string>True</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>ERP5Site_verifyBT5UpgradeIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Verify instance integrity launch all Integrity Verification scripts. \n
\n
Run all verification scripts defined at Signature.\n
"""\n
message_list = []\n
\n
for script_id in context.ERP5Site_getUpgraderSignature(\'integrity_verification_script_id_list\'):\n
result = context.ERP5Site_runVerificationScript(script_id)\n
if result is not None:\n
message_list.append(result)\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>message_list</string>
<string>_getiter_</string>
<string>_getattr_</string>
<string>context</string>
<string>script_id</string>
<string>result</string>
<string>None</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>ERP5Site_verifyInstanceIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Verify if this instance is a properly configured one.\n
This script could be used in functional tests\n
"""\n
plugin_id_list = [\'default_memcached_plugin\',\'persistent_memcached_plugin\' ]\n
portal = context.getPortalObject()\n
key_prefix = \'upgrade_verification\'\n
if getattr(portal, "erp5_site_global_id", None) == "test_client_chroot":\n
# This is a test environment so all instance will have the same prefix.\n
# change key_prefix to prevent useless failure.\n
key_prefix = \'upgrade_verification%s\' % str(float(DateTime()))\n
\n
message_list = []\n
\n
def assertEquals(value1, value2, label=""):\n
if not (value1 == value2):\n
message_list.append("Memcached: %s Fail (%s != %s)" % (label, value1, value2))\n
\n
def assertNotEquals(value1, value2, label=""):\n
if not (value1 != value2):\n
message_list.append("Memcached: %s Fail (%s == %s)" % (label, value1, value2))\n
\n
# Verify if memcached and plugins are present into the instance\n
portal_memcached = getattr(context.getPortalObject(), "portal_memcached", None)\n
if portal_memcached is not None:\n
plugin_object_id_list = portal_memcached.objectIds()\n
for plugin_id in plugin_id_list:\n
if plugin_id not in plugin_object_id_list:\n
message_list.append("Memcached plugin %s is not present." % plugin_id)\n
else: \n
message_list.append("Portal Memcached is not present.")\n
\n
# Test Plugins\n
def getMemcachedDict():\n
return portal_memcached.getMemcachedDict(key_prefix=key_prefix, \n
plugin_path=\'portal_memcached/default_memcached_plugin\')\n
\n
# If this is not None the value was get from another instance\n
site_id = getattr(portal, "erp5_site_global_id", None)\n
if getMemcachedDict().get("upgrade_verification_key", site_id) == "Foo Bar":\n
# Solve some possible legacy.\n
getMemcachedDict().set("upgrade_verification_key", site_id)\n
assertEquals(getMemcachedDict().get("upgrade_verification_key", site_id), site_id, "upgrade_verification_key")\n
getMemcachedDict().set("upgrade_verification_key", site_id)\n
assertEquals(getMemcachedDict().get("upgrade_verification_key", None), site_id, "upgrade_verification_key")\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>plugin_id_list</string>
<string>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>key_prefix</string>
<string>getattr</string>
<string>None</string>
<string>str</string>
<string>float</string>
<string>DateTime</string>
<string>message_list</string>
<string>assertEquals</string>
<string>assertNotEquals</string>
<string>portal_memcached</string>
<string>plugin_object_id_list</string>
<string>_getiter_</string>
<string>plugin_id</string>
<string>getMemcachedDict</string>
<string>site_id</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>ERP5Site_verifyMemcachedIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>ERP5Site_verifyProductPathUpgrade</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_verifyProductPathUpgrade</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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[
message_list = []\n
\n
catalog = context.portal_catalog.erp5_mysql_innodb\n
filter_dict = catalog.getFilterDict()\n
catalog_filter_dict = {}\n
for key in filter_dict:\n
catalog_filter_dict[key] = filter_dict[key][\'expression\']\n
\n
expect_expression_dict = context.ERP5Site_getUpgraderSignature(\'catalog_filter_dict\')\n
\n
if len(catalog_filter_dict.keys()) != len(expect_expression_dict.keys()):\n
message_list.append("Catalog filter have diferent key lenght (%s != %s): %s != %s" % \\\n
(len(catalog_filter_dict.keys()), len(expect_expression_dict.keys()),\n
catalog_filter_dict.keys(), expect_expression_dict.keys()))\n
\n
missing_key_list = [ key for key in expect_expression_dict if key not in catalog_filter_dict ]\n
\n
if len(missing_key_list) > 0:\n
message_list.append("Missing keys at Catalog filter: %s" % missing_key_list)\n
\n
for key in expect_expression_dict:\n
if expect_expression_dict[key] != catalog_filter_dict[key]:\n
message_list.append("Wrong expression definition found at %s: %s (Expected) != %s (Found)" % (key, expect_expression_dict[key], catalog_filter_dict[key]))\n
\n
real_data_verified = 0\n
for person in context.getPortalObject().person_module.contentValues():\n
organisation = person.getSubordinationValue()\n
if organisation is not None:\n
real_data_verified = 1\n
if person not in organisation.getSubordinationRelatedValueList(portal_type=\'Person\'):\n
message_list.append("Catalog is broken. Acquired categories are not in category table.")\n
# it is enough to check one object - there is full reindex done\n
break\n
\n
if not real_data_verified:\n
message_list.append("It was not possible to verify catalog integrity using real data.")\n
return message_list\n
]]></string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>message_list</string>
<string>_getattr_</string>
<string>context</string>
<string>catalog</string>
<string>filter_dict</string>
<string>catalog_filter_dict</string>
<string>_getiter_</string>
<string>key</string>
<string>_getitem_</string>
<string>_write_</string>
<string>expect_expression_dict</string>
<string>len</string>
<string>append</string>
<string>$append0</string>
<string>missing_key_list</string>
<string>real_data_verified</string>
<string>person</string>
<string>organisation</string>
<string>None</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>ERP5Site_verifySQLCatalogFilterIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
Verify if this instance is a properly configured one.\n
This script could be used in functional tests\n
"""\n
\n
portal = context.getPortalObject()\n
\n
message_list = []\n
\n
message_list.extend(context.ERP5Site_upgradePythonExecutable())\n
\n
message_list.extend(context.ERP5Site_upgradeSoftwareHome())\n
\n
message_list.extend(context.ERP5Site_upgradeProductPath())\n
\n
message_list.extend(context.ERP5Site_upgradeBusinessTemplateList())\n
\n
message_list.extend(context.ERP5Site_upgradeGlobalPropertyList())\n
\n
message_list.extend(context.ERP5Site_upgradeValidationStateList())\n
\n
message_list.extend(context.ERP5Site_upgradeWorkflowChain())\n
\n
message_list.extend(context.ERP5Site_upgradeSQLCatalog())\n
\n
message_list.extend(context.ERP5Site_upgradeMySQLCharset())\n
\n
if getattr(context, \'WizardTool_isPersonReferenceGloballyUnique\', None) is not None:\n
if len(context.PersonModule_getUserAccountList(\'occupied\')) == 0 and \\\n
getattr(portal.acl_users, \'nexedi_authentication\', None) is not None:\n
# If there is collision this verification should not be launch be\n
# because it should fail anyway.\n
message_list.extend(context.ERP5Site_upgradeData())\n
\n
return message_list\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</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>_getattr_</string>
<string>context</string>
<string>portal</string>
<string>message_list</string>
<string>getattr</string>
<string>None</string>
<string>len</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>ERP5Site_verifyUpgradeIntegrity</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?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>"""\n
By default the upgrade is never required for None of\n
Business template.\n
\n
This script will be probably rewrite on other skin folder.\n
"""\n
return 0\n
</string> </value>
</item>
<item>
<key> <string>_code</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string>bt5_title</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>bt5_title</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_isUpdateCatalogRequired</string> </value>
</item>
<item>
<key> <string>warnings</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<tuple>
<global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/>
<tuple/>
</tuple>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_function</string> </key>
<value> <string>TemplateTool_reinstallBT5</string> </value>
</item>
<item>
<key> <string>_module</string> </key>
<value> <string>ERP5UpgraderUtils</string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>TemplateTool_reinstallBT5</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
2010-02-16 nicolas
* Add new properties in Signature in order to trig some actions just before or just after business template update/installation
2010-02-12 nicolas
* add REINSTALABLE_BT5_ID_LIST inside Signature API in order to call reinstallation of Business Templates and revert local changes.
* Extend Unit Test (work on going, known bug will be fixed)
Reviewed by Rafael
2009-08-04 jps
* Refactored (and broken) by JPS with lots of pseudo-code
2009-04-17 ivan
* Split to specific migrations using skin folders
2009-03-20 ivan
* Start to refector as generic ERP5 upgrader
2009-03-12 ivan
* Initial import
\ No newline at end of file
erp5_upgrader can be used to upgrade any site:
* create Business Template which overrides upgrader scripts in its own skin (XXX_erp5_upgrader)
* set extremely high business_template_skin_layer_priority (like 10000.0)
* develop this Business Template
* to upgrade site install first XXX_erp5_upgrader, then erp5_upgrader
* voilà - site upgraded
\ No newline at end of file
Nexedi SA
\ No newline at end of file
The erp5_upgrader business template tries to upgrade ERP5 to the latest version (ie. SVN HEAD) whatever the version which is currently installed. It uses introspection to decide what should be upgraded (or not) and how. It is based on an alarm design which makes sure that everything on a given ERP5 site satisfies certain criteria: version of system libraries, version of products, version of business templates, existence of certain tools, configuration of certain tools, etc. If all alarms are in OK state, it is considered as a proof that the upgrade process went well from an instance maintenance point of view (but it does not prove that the upgrade process produces working instances).
erp5_upgrader is tested on a given set of instances in various releases (ex. 5.4.2, 5.4.3). Once all tests pass, it can be released, together with the rest of other business templates. The release process of erp5_upgrader includes a minimal patch of the XML which replaces the HEAD upgrade by appropriate release number.
\ No newline at end of file
rafael
ivan
luke
\ No newline at end of file
None
\ No newline at end of file
522
\ No newline at end of file
None
\ No newline at end of file
ERP5UpgraderUtils
\ No newline at end of file
portal_alarms/bt5_upgrader
portal_alarms/finalize_upgrader
portal_alarms/product_upgrader
portal_alarms/system_upgrader
portal_alarms/upgrader_controller
portal_workflow/business_template_installation_workflow/scripts/BusinessTemplate_install
\ No newline at end of file
erp5_upgrader
\ No newline at end of file
0
\ No newline at end of file
erp5_upgrader
\ No newline at end of file
5.4.6
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment