Commit d022f1cb authored by Arnaud Fontaine's avatar Arnaud Fontaine Committed by Gabriel Monnerat

ZODB Components: Migrate Products.ERP5Type.Log from filesystem.

testUpgradeInstanceWithOldDataFs: Upgrade erp5_upgrader too (it was in keep
list until now) as old Data.fs contains ERP5UpgraderUtils Extension with import of
Products.ERP5Type.Log. Although, erp5_upgrader should probably be automatically
upgraded before even starting the upgrade...
parent 30248c8a
from Products.ERP5Type.Document import newTempBase
from Products.ZSQLCatalog.SQLCatalog import SimpleQuery
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
portal = context.getPortalObject()
request = portal.REQUEST
params = portal.ERP5Site_getAccountingSelectionParameterDict(selection_name=selection_name)
......
"""Just an alias for real script
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('DeprecationWarning: Please use Document_getStandardFilename')
return context.Document_getStandardFilename(format=format)
"""Find and returns Person object for current logged in user.
Returns None if no corresponding person, for example when not using ERP5Security.ERP5UserManager.
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
if user_name is None:
log('DEPRECATED: call context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()')
return context.getPortalObject().portal_membership.getAuthenticatedMember().getUserValue()
......
......@@ -5,7 +5,7 @@ and the getObject API of ERP5Catalog.
This script has a proxy role to make sure we can find person documents in the
catalog.
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
object = sci['object']
portal = object.getPortalObject()
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
after_script_id = context.getResourceValue().getConfigurationAfterScriptId()
after_script = getattr(context, after_script_id, None)
......
""" This script will be called to apply the customization. """
from AccessControl import getSecurityManager
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
portal = context.getPortalObject()
bt = portal.portal_templates.getInstalledBusinessTemplate("erp5_demo_maxma_sample")
......
""" This script will be called to apply the customization. """
from AccessControl import getSecurityManager
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
portal = context.getPortalObject()
portal_preferences = portal.portal_preferences
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('Obsoleted, please use Base_addEvent (with Base_viewAddEventDialog) instead')
return context.Base_addEvent(title, direction, portal_type, resource, **kw)
from Products.PythonScripts.standard import newline_to_br
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log("Event_getTextContentCorrespondToFormat is deprecated, use Event_getEditorFieldTextContent instead", level=100) # WARNING
......
......@@ -16,7 +16,7 @@ import transaction
import Acquisition
import astor
import importlib
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
# Display matplotlib figure automatically like
# the original python kernel
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('Launching activities to setup the demo configuration!')
kw = {}
......
......@@ -9,7 +9,7 @@ try:
if not context.hasBaseData():
error_message = context.Base_translateString("This document is not converted yet.")
except Exception, e:
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log("asStrippedHTML", str(e))
error_message = "%s %s" % (context.Base_translateString("Preview Error:"),
str(e))
......
from Products.ERP5.Document.Document import ConversionError
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
from ZODB.POSException import ConflictError
from xmlrpclib import Fault
from socket import error as SocketError
......
from ZODB.POSException import ConflictError
from Products.ERP5.Document.Document import ConversionError
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
message = None
try:
......
......@@ -8,7 +8,8 @@ It does the following:
Otherwise it just uploads the file, bumps up revision number and calls metadata discovery script.
"""
from Products.ERP5Type.Log import log, WARNING
from erp5.component.module.Log import log, WARNING
from Products.ERP5Type.Message import translateString
translate = context.Base_translateString
request = context.REQUEST
......
......@@ -9,7 +9,7 @@ Differences to the stock implementation:
(unless we say it is strict)
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
category_list = []
......
......@@ -2,7 +2,7 @@
Security categories assigned from the Person who is set as the destination
of the document (e.g. in Memo type).
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
category_list = []
for ob in object.getDestinationValueList():
......
......@@ -4,7 +4,7 @@
"""
from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
#log("depth: %s parent: %s kw: %s" % (depth, repr(parent), repr(kw)))
#log("selection: %s" % repr(context.portal_selections.getSelectionParamsFor('crawled_content_selection')))
......
"""Obsolete compatibility script.
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log("Obsolete script, please use BaseType_copyRoleList instead")
print 'cloning role information from'
......
......@@ -12,9 +12,8 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
extra_param_json - JSON serialized extra parameters for the dialog script
"""
from Products.ERP5Type.Log import log, DEBUG, INFO, WARNING, ERROR
from Products.Formulator.Errors import FormValidationError, ValidationError
from ZTUtils import make_query
from erp5.component.module.Log import log, WARNING
from Products.Formulator.Errors import FormValidationError
import json
DOCUMENT_COUNT_LIMIT = 50
......
......@@ -5,7 +5,7 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
:param level: {str | int} use ERP5Type.Log levels or simply strings like "info", "warning", or "error"
"""
import json
from Products.ERP5Type.Log import WARNING, ERROR
from erp5.component.module.Log import WARNING, ERROR
if isinstance(level, (str, unicode)):
if level.lower() == "error":
......
......@@ -57,7 +57,7 @@ import time
from email.Utils import formatdate
import re
from zExceptions import Unauthorized
from Products.ERP5Type.Log import log, DEBUG, INFO, WARNING, ERROR
from erp5.component.module.Log import log, WARNING, ERROR
from Products.ERP5Type.Message import Message
from Products.ERP5Type.Utils import UpperCase
from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery
......
......@@ -2,7 +2,7 @@ from Products.CMFCore.WorkflowCore import WorkflowException
from Products.Formulator.Errors import FormValidationError
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Log import log, WARNING
from erp5.component.module.Log import WARNING
portal = context.getPortalObject()
request = REQUEST or context.REQUEST
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('DepracationWarning: Please use ContributionTool_getPropertyDictFromFilename')
return context.ContributionTool_getPropertyDictFromFilename(file_name, property_dict)
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('Depracated usage of Item_getQuantityUnit, please use Item_getQuantityUnitItemList instead')
return context.Item_getQuantityUnitItemList()
......@@ -32,7 +32,7 @@ import numpy as np
from copy import copy
from math import sqrt
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
from Products.CMFActivity.ActiveResult import ActiveResult
from sklearn.base import clone
from sklearn.utils import check_random_state
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
def getRealRelativeUrl(document):
return '/'.join(context.getPortalObject().portal_url.getRelativeContentPath(document))
......
import json
import base64
from erp5.component.module.Log import log
def getElementFromContent(key, content):
before_template = '"%s" type="text/x-renderjs-configuration">'
before = before_template % key
after = '</script>'
start = content.find(before) + len(before)
stop = content.find(after, start)
result = content[start:stop]
if (not "<" in result) and (not ">" in result) and (result != ""):
return result
return None
portal = context.getPortalObject()
portal_catalog = portal.portal_catalog
try:
hateoas_appcache = context.getLayoutProperty("hateoas_appcache", default="hateoas_appcache")
router_file_reference = context.getLayoutProperty("configuration_router_gadget_url", default="")
if router_file_reference is "":
raise ValueError("Router Gadget Layout Property is missing")
result_list = portal_catalog.getDocumentValueList(
portal_type = 'Web Page',
reference = router_file_reference,
validation_state = 'published%')
if len(result_list) == 0:
raise ValueError("Router web page '%s' not found" % router_file_reference)
router_content = result_list[0].getTextContent()
portal_skin = getElementFromContent("portal_skin_folder", router_content)
if portal_skin is None:
raise KeyError("portal_skin_folder setting not found in router")
app_action_string = getElementFromContent("app_actions", router_content)
if app_action_string is None:
raise KeyError("app_actions setting not found in router")
app_action_list = []
app_action_string = app_action_string.replace('(', '[').replace(')', ']').replace(',]', ']').replace("'", '"')
app_action_raw_list = json.loads(app_action_string)
for app_action in app_action_raw_list:
pair = app_action.split(" | ")
if len(pair) != 2:
raise SyntaxError("Syntax error in app_action router setting")
app_action_list.append(pair)
portal_actions_dict = {}
for app_action in app_action_list:
portal_type = str(app_action[0])
action = str(app_action[1])
if portal_type in portal_actions_dict:
portal_actions_dict[portal_type] = portal_actions_dict[portal_type] + [action]
else:
portal_actions_dict[portal_type] = [action]
new_dialog_form_list = []
for portal_type in portal_actions_dict:
portal_type_dict_setting = portal_type.replace(" ", '_').lower() + "_dict"
portal_type_dict = getElementFromContent(portal_type_dict_setting, router_content)
if portal_type_dict is not None:
portal_type_dict = json.loads(portal_type_dict)
if "new_content_dialog_form" in portal_type_dict:
new_dialog_form_list.append(str(portal_type_dict["new_content_dialog_form"]))
configuration_path_list = []
for key in portal_actions_dict:
path = "portal_types/%s" % key
configuration_path_list.append(base64.b64encode(path))
for action in portal_actions_dict[key]:
path = "portal_types/%s/%s" % (key, action)
configuration_path_list.append(base64.b64encode(path))
try:
action_object = context.restrictedTraverse(path)
form = action_object.getActionText().split('/')[-1]
path = "portal_skins/%s/%s" % (portal_skin, form)
configuration_path_list.append(base64.b64encode(path))
except KeyError as e:
raise KeyError("Error getting portal action info: " + str(e))
if new_dialog_form_list:
for form in new_dialog_form_list:
path = "portal_skins/%s/%s" % (portal_skin, form)
configuration_path_list.append(base64.b64encode(path))
url_list = []
for path in configuration_path_list:
url_list.append(hateoas_appcache + "/definition_view/" + path)
return url_list
except (ValueError, KeyError, SyntaxError, AttributeError) as e:
if batch_mode == "0":
raise e
log('ERROR generating Base64 configuration url list: ' + str(e))
return []
#from Products.ERP5Type.Log import log
#from erp5.component.module.Log import log
request = context.REQUEST
object_path = request.get('object_path')
if object_path is None:
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('task_list','starting')
task_module = context.getDefaultModule('Task Report')
log('task_list','next1')
......
"""
This script will setup the default ERP5's configuration as saved in erp5_scalability_test business template.
As this modifies your site care must be taken!
"""
from erp5.component.module.Log import log
portal = context.getPortalObject()
configurator = getattr(portal.business_configuration_module, "default_standard_configuration", None)
if configurator is None:
log("Could not find the scalability business configuration object. Be sure to have erp5_scalability_test business template installed.")
return
if not portal.ERP5Site_isReady():
# nothing installed, thus do it
log("START auto-configuration for ERP5's default configuration.")
context.ERP5Site_bootstrapScalabilityTest(user_quantity=0, setup_activity_tool=False, create_test_data=False, set_id_generator=False)
else:
log("All configured. Nothing to do.")
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('Deprecated: use Base_getPreferredSectionItemList instead.')
section_cat = context.portal_preferences.getPreferredSectionCategory()
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log('Deprecated: use Base_getPreferredSectionItemList instead.')
section_cat = context.portal_preferences.getPreferredSectionCategory()
......
......@@ -8,7 +8,7 @@ It will also not work if strict security is set on simulation. It's recommended
(Delivery) Causality Movement Group as delivery level movement group in the corresponding
delivery builder.
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
LOG = lambda msg:log(
"Delivery_setCausalityFromSimulation on %s" % context.getPath(), msg)
LOG = lambda msg:'DISABLED'
......
# We wants to get data in order to do a nice summary of items inside the order
# This report will mainly usefull when the same resource is ordered on many
# different lines
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
if target_language:
container.REQUEST['AcceptLanguage'].set(target_language, 10)
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log("Folder method received dialog_id, form_id, uids and {!s}".format(kwargs.keys()))
......
"""
Used to set properties for Listbox
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
field = context
d = dict(
......
"""
Upload a screenshot taken by the test to ERP5
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
data_uri = context.REQUEST.form.get('data_uri', 'default')
......
......@@ -6,7 +6,7 @@
XXX - redirect, translation of dialogs
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
req = context.REQUEST
# check if everything was filled
......
......@@ -33,7 +33,6 @@ from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
from Products.ERP5Type.Cache import caching_instance_method
from Products.ERP5Type.Cache import CachingMethod, CacheCookieMixin
from Products.ERP5Type.ERP5Type import ERP5TypeInformation
from Products.ERP5Type.Log import log as unrestrictedLog
from Products.CMFActivity.Errors import ActivityPendingError
import ERP5Defaults
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
......@@ -1774,12 +1773,13 @@ class ERP5Site(FolderMixIn, CMFSite, CacheCookieMixin):
def log(self, *args, **kw):
"""Put a log message
See the warning in Products.ERP5Type.Log.log
See the warning in erp5.component.module.Log.log
Catchall parameters also make this method not publishable to avoid DoS.
"""
warnings.warn("The usage of ERP5Site.log is deprecated.\n"
"Please use Products.ERP5Type.Log.log instead.",
"Please use erp5.component.module.Log.log instead.",
DeprecationWarning)
from erp5.component.module.Log import log as unrestrictedLog
unrestrictedLog(*args, **kw)
security.declarePublic('setPlacelessDefaultReindexParameters')
......
......@@ -26,6 +26,7 @@
#
##############################################################################
# pylint: disable=unused-import
from zLOG import (
LOG,
INFO,
......@@ -41,33 +42,35 @@ from zLOG import (
from traceback import extract_stack
marker_ = []
marker_ = object()
def log(description, content=marker_, level=INFO):
"""Put a log message
"""Put a log message
This method is supposed to be used by restricted environment,
such as Script (Python).
This method is supposed to be used by restricted environment,
such as Script (Python).
WARNING: When called with more than 1 argument, the first one is appended
to the usual information about the caller, in order to form a
subsystem string. Because a logging.Logger object is created for
each subsystem, and is never freed, you can experience memory
leaks if description is not constant.
"""
if content is marker_: # allow for content only while keeping interface
description, content = content, description
st = extract_stack()
head = []
for frame in st[-2:-6:-1]: # assume no deep nesting in Script (Python)
if frame[3] is not None and frame[3].startswith('self.log'): # called from class
head.append('%s, %d' % (frame[2], frame[1]))
break
if frame[0] == 'Script (Python)': # does anybody log from ZPT or dtml?
head.append('%s, %d' % (frame[2], frame[1]))
elif frame[0] == 'ERP5 Python Script':
head.append('%s, %d' % (frame[2], frame[1]))
del st # Prevent cycling references.
head = ' -> '.join(head)
description = '%s: %s' % (head, description)
LOG(description, level, content)
WARNING: When called with more than 1 argument, the first one is appended
to the usual information about the caller, in order to form a
subsystem string. Because a logging.Logger object is created for
each subsystem, and is never freed, you can experience memory
leaks if description is not constant.
"""
if content is marker_: # allow for content only while keeping interface
description, content = content, description
st = extract_stack()
head = []
for frame in st[-2:-6:-1]: # assume no deep nesting in Script (Python)
if frame[3] is not None and frame[3].startswith('self.log'): # called from class
head.append('%s, %d' % (frame[2], frame[1]))
break
if frame[0] == 'Script (Python)': # does anybody log from ZPT or dtml?
head.append('%s, %d' % (frame[2], frame[1]))
elif frame[0] == 'ERP5 Python Script':
head.append('%s, %d' % (frame[2], frame[1]))
del st # Prevent cycling references.
head = ' -> '.join(head)
description = '%s: %s' % (head, description)
LOG(description, level, content)
from AccessControl.SecurityInfo import allow_module
allow_module(__name__)
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Module Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Log</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5Type.Log</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module.erp5.Log</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Module Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,7 +2,7 @@
Generic method called when submitting a form in dialog mode.
Responsible for validating form data and redirecting to the form action.
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
# XXX We should not use meta_type properly,
# XXX We need to discuss this problem.(yusei)
......
......@@ -6,7 +6,7 @@ This script should be used to detect a listbox without having to name it "listbo
Christophe Dumez <christophe@nexedi.com>
"""
from Products.ERP5Type.Log import log, ERROR
from erp5.component.module.Log import log, ERROR
def isListBox(field):
if field.meta_type == "ListBox":
......
"""Compatibility script for old portal type Base_printPdf actions.
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
portal = context.getPortalObject()
log('Deprecated Base_printPdf action called on a %s. '
'Remove this action to use global print action.' % context.getPortalType())
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
# this script is no longer needed.
log('Category_getSortedCategoryChildValueList', 'use getCategoryChildValueList method')
......
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log("ERP5Type_getSecurityCategoryFromArrow is deprecated, "
"use ERP5Type_getSecurityCategoryFromContent instead")
......
module.erp5.DateUtils
module.erp5.DiffUtils
module.erp5.ExpandPolicy
module.erp5.GeneratedAmountList
module.erp5.Log
module.erp5.MovementCollectionDiff
module.erp5.MovementGroup
\ No newline at end of file
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
from Products.ZSQLCatalog.SQLCatalog import Query
# warn by logging (not possible use python's warn module in restricted environment)
......
# Script to call in action scripts before executig the actual action.
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
log("ERP5Site_prepare is deprecated, "
"use Base_updateListboxSelection instead")
......
......@@ -2,7 +2,7 @@ from Products.CMFCore.WorkflowCore import WorkflowException
from Products.Formulator.Errors import FormValidationError
from Products.DCWorkflow.DCWorkflow import ValidationFailed
from Products.ERP5Type.Message import translateString
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
portal = context.getPortalObject()
request = kw.get("REQUEST", None) or context.REQUEST
......
......@@ -185,7 +185,7 @@ class TestInvalidationBug(ERP5TypeTestCase):
skin_folder.manage_delObjects(ids=['create_script'])
skin = createZODBPythonScript(skin_folder, 'create_script', '**kw',
"""
from Products.ERP5Type.Log import log
from erp5.component.module.Log import log
id_list = []
for x in xrange(0, 1):
organisation = context.newContent()
......
......@@ -76,7 +76,6 @@ from Products.ERP5Type.mixin.property_translatable import PropertyTranslatableBu
from Products.ERP5Type.XMLExportImport import Base_asXML
from Products.ERP5Type.Cache import CachingMethod, clearCache, getReadOnlyTransactionCache
from Accessor import WorkflowState
from Products.ERP5Type.Log import log as unrestrictedLog
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.Accessor.TypeDefinition import type_definition
......@@ -3172,12 +3171,13 @@ class Base( CopyContainer,
def log(self, *args, **kw):
"""Put a log message
See the warning in Products.ERP5Type.Log.log
See the warning in erp5.component.module.Log.log
Catchall parameters also make this method not publishable to avoid DoS.
"""
warnings.warn("The usage of Base.log is deprecated.\n"
"Please use Products.ERP5Type.Log.log instead.",
"Please use erp5.component.module.Log.log instead.",
DeprecationWarning)
from erp5.component.module.Log import log as unrestrictedLog
unrestrictedLog(*args, **kw)
# Dublin Core Emulation for CMF interoperatibility
......
......@@ -181,7 +181,6 @@ ModuleSecurityInfo('Products.ERP5Type.Message').declarePublic('translateString')
allow_module('Products.ERP5Type.Error')
allow_module('Products.ERP5Type.Errors')
allow_module('Products.ERP5Type.JSONEncoder')
allow_module('Products.ERP5Type.Log')
allow_module('Products.ERP5Type.ImmediateReindexContextManager')
ModuleSecurityInfo('Products.ERP5Type.JSON').declarePublic('dumps', 'loads')
ModuleSecurityInfo('Products.ERP5Type.Constraint').declarePublic('PropertyTypeValidity')
......
##############################################################################
#
# Copyright (c) 2020 Nexedi SA and Contributors. All Rights Reserved.
# Arnaud Fontaine <arnaud.fontaine@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 Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
class TestUpgradeInstanceWithOldDataFs(ERP5TypeTestCase):
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
'erp5_full_text_mroonga_catalog',
'erp5_base',
'erp5_workflow',
'erp5_accounting',
'erp5_configurator',
'erp5_simulation',
'erp5_pdm',
'erp5_trade',
'erp5_accounting',
'erp5_configurator_standard_trade_template',
'erp5_upgrader')
def testUpgrade(self):
if not self.portal.portal_templates.getRepositoryList():
self.setupAutomaticBusinessTemplateRepository(
searchable_business_template_list=["erp5_core", "erp5_base"])
from Products.ERP5Type.tests.utils import createZODBPythonScript
createZODBPythonScript(
self.portal.portal_skins.custom,
'Base_getUpgradeBusinessTemplateList',
'',
"""return (('erp5_base',
'erp5_configurator_standard_trade_template',
'erp5_configurator_standard',
'erp5_jquery',
'erp5_xhtml_style',
'erp5_upgrader'),
())""")
self.tic()
alarm = self.portal.portal_alarms.promise_check_upgrade
alarm.solve()
self.tic()
self.assertEquals(alarm.getLastActiveProcess().getResultList(), [])
# Make sure that *all* Portal Type can be loaded after upgrade
import erp5.portal_type
from Products.ERP5Type.dynamic.lazy_class import ERP5BaseBroken
error_list = []
for portal_type_obj in self.portal.portal_types.listTypeInfo():
portal_type_id = portal_type_obj.getId()
portal_type_class = getattr(erp5.portal_type, portal_type_id)
portal_type_class.loadClass()
if issubclass(portal_type_class, ERP5BaseBroken):
error_list.append(portal_type_id)
self.assertEquals(
error_list, [],
msg="The following Portal Type classes could not be loaded (see zLOG.log): %r" % error_list)
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