Commit 48c45fbd authored by Arnaud Fontaine's avatar Arnaud Fontaine

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 e327c875
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)
......
......@@ -2,6 +2,6 @@
# pylint: disable=redefined-builtin
"""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
document = sci['object']
portal = document.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 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:
......
......@@ -10,7 +10,7 @@ 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
......
......@@ -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 obj.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,7 +12,7 @@ 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, WARNING
from erp5.component.module.Log import log, WARNING
from Products.Formulator.Errors import FormValidationError
import json
......
......@@ -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, WARNING, ERROR
from erp5.component.module.Log import log, WARNING, ERROR
from Products.ERP5Type.Message import Message
from collections import OrderedDict
from Products.ERP5Form.Selection import Selection
......
......@@ -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 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 Products.ERP5Type.Log import log
from erp5.component.module.Log import log
def getElementFromContent(key, content):
before_template = '"%s" type="text/x-renderjs-configuration">'
......
#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')
......
......@@ -2,7 +2,7 @@
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 Products.ERP5Type.Log import log
from erp5.component.module.Log import log
portal = context.getPortalObject()
configurator = getattr(portal.business_configuration_module, "default_standard_configuration", None)
......
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'
......
......@@ -4,7 +4,7 @@
# 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
......@@ -1767,12 +1766,13 @@ class ERP5Site(ResponseHeaderGenerator, 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,7 +42,7 @@ from zLOG import (
from traceback import extract_stack
marker_ = []
marker_ = object()
def log(description, content=marker_, level=INFO):
"""Put a log message
......@@ -71,3 +72,5 @@ def log(description, content=marker_, level=INFO):
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")
......
......@@ -2,5 +2,6 @@ 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()
......
......@@ -74,7 +74,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
......@@ -3187,12 +3186,13 @@ class Base(
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
......
......@@ -179,7 +179,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')
......
......@@ -56,8 +56,9 @@ class TestUpgradeInstanceWithOldDataFs(ERP5TypeTestCase):
'erp5_configurator_standard_trade_template',
'erp5_configurator_standard',
'erp5_jquery',
'erp5_xhtml_style'),
['erp5_upgrader'])""")
'erp5_xhtml_style',
'erp5_upgrader'),
())""")
self.tic()
alarm = self.portal.portal_alarms.promise_check_upgrade
......
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