Commit 38935ab5 authored by Jérome Perrin's avatar Jérome Perrin

base: set portal_status_level in error case of dialog actions

parent cb2a7c63
......@@ -19,4 +19,5 @@ return context.Base_redirect(form_id,
keep_items=dict(selection_name=selection_name,
selection_index=selection_index,
cancel_url=cancel_url,
portal_status_message=translateString("Cancelled.")),)
portal_status_message=translateString("Cancelled."),
portal_status_level='error'),)
......@@ -3,7 +3,10 @@ ptype = context.getPortalType()
if not description:
return context.Base_redirect(dialog_id,
keep_items = dict(portal_status_message = translateString("Question can not be empty.",), cancel_url = cancel_url))
keep_items = dict(
portal_status_message=translateString("Question can not be empty.",),
portal_status_level='error',
cancel_url=cancel_url))
query = context.Base_newQuery(description=description)
query_id = query.getId()
......
......@@ -13,7 +13,10 @@ if default_career is None:
return context.Base_redirect(form_id=form_id,
selection_name=selection_name,
selection_index=selection_index,
keep_items={'portal_status_message': message})
keep_items={
'portal_status_message': message,
'portal_status_level': 'error',
})
else:
# Copy and paste the default career.
# Change IDs
......@@ -25,8 +28,10 @@ else:
return context.Base_redirect(form_id=form_id,
selection_name=selection_name,
selection_index=selection_index,
keep_items={'portal_status_message': message})
keep_items={
'portal_status_message': message,
'portal_status_level': 'error',
})
new_start_date = default_career.getStopDate()
cb_data = person.manage_copyObjects(ids=(new_id,))
......
......@@ -14,4 +14,4 @@ else:
context.portal_caches.clearCache(('erp5_content_short',))
context.logout()
return context.Base_redirect()
return context.Base_redirect(dialog_id, keep_items={'portal_status_message': msg})
return context.Base_redirect(dialog_id, keep_items={'portal_status_message': msg, 'portal_status_level': 'error'})
......@@ -34,6 +34,7 @@ import mock
import itertools
import transaction
import unittest
import urlparse
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript
from AccessControl.SecurityManagement import newSecurityManager
......@@ -584,7 +585,13 @@ class TestPreferences(UserManagementTestCase):
current_password='bad' + password,
new_password=new_password,
)
self.assertEqual(result, self.portal.absolute_url()+'/portal_preferences/PreferenceTool_viewChangePasswordDialog?portal_status_message=Current%20password%20is%20wrong.')
parsed_url = urlparse.urlparse(result)
self.assertEqual(
parsed_url.path.split('/')[-2:],
['portal_preferences', 'PreferenceTool_viewChangePasswordDialog'])
self.assertEqual(
urlparse.parse_qs(parsed_url.query),
{'portal_status_message': ['Current password is wrong.'], 'portal_status_level': ['error']})
self.login()
self._assertUserExists(login, password)
......
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