Commit 410744dc authored by Romain Courteaud's avatar Romain Courteaud

[product/ERP5Type] Introduce Log.py for compatibility

Without it, it is not possible to upgrade instances since:
48c45fbd

[test/upgradeOldDataFS] use UI callables
Ensure the admin will able to trigger the upgrader
parent 9d930b40
Pipeline #10896 failed with stage
in 0 seconds
##############################################################################
#
# Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved.
# Yoshinori Okuji <yo@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.Utils import deprecated
from zLOG import (
LOG,
INFO
)
marker_ = []
@deprecated
def log(description, content=marker_, level=INFO):
"""Deprecated method
Use erp5.componement.Log instead.
Kept for compatbility to allow instance upgrade.
"""
if content is marker_: # allow for content only while keeping interface
description, content = content, description
LOG(description, level, content)
......@@ -179,6 +179,7 @@ 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')
......
......@@ -26,8 +26,13 @@
#
##############################################################################
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
import StringIO
import urllib
import httplib
class TestUpgradeInstanceWithOldDataFs(ERP5TypeTestCase):
def getBusinessTemplateList(self):
return ('erp5_core_proxy_field_legacy',
'erp5_full_text_mroonga_catalog',
......@@ -95,9 +100,42 @@ class TestUpgradeInstanceWithOldDataFs(ERP5TypeTestCase):
self.tic()
alarm = self.portal.portal_alarms.promise_check_upgrade
alarm.solve()
# Ensure it is viewable
alarm.view()
# Call active sense
alarm.activeSense()
self.tic()
# XXX No idea why active sense must be called twice...
alarm.activeSense()
self.tic()
self.assertNotEquals([x.detail for x in alarm.getLastActiveProcess().getResultList()], [])
# Solve divergencies, like called from the form_dialog
# XXX We only check that Base_callDialogMethod can be correctly executed
# and we do not check the result (the redirect can be an Unauthorized error)
# A better version would be to use the Location header result to trigger Alarm_solve
ret = self.publish(
'%s/portal_alarms/promise_check_upgrade' % self.portal.getPath(),
basic='%s:current' % self.id(),
stdin=StringIO.StringIO(urllib.urlencode({
'Base_callDialogMethod:method': '',
'dialog_id': 'Alarm_viewSolveDialog',
'dialog_method': 'Alarm_solve',
'form_id': 'Alarm_view',
'selection_name': 'foo_selection',
})),
request_method="POST",
handle_errors=False
)
self.assertEqual(httplib.FOUND, ret.getStatus())
alarm.Alarm_solve()
self.tic()
self.assertEquals(alarm.getLastActiveProcess().getResultList(), [])
self.assertEquals([x.detail for x in alarm.getLastActiveProcess().getResultList()], [])
# Make sure that *all* Portal Type can be loaded after upgrade
import erp5.portal_type
......
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