Commit 760fa111 authored by Sebastien Robin's avatar Sebastien Robin

- add unit test to check that there is no unicode error

  any more when we create preference for a person with
  a non ascii characters in it's name
- in Message, import Globals instead of get_request,
  like this we can use the version of get_request
  patched by ERP5TypeTestCase

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@39180 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bcc656a7
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2005 Nexedi SARL and Contributors. All Rights Reserved.
......@@ -34,6 +35,8 @@ from AccessControl import Unauthorized
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type import Permissions
import transaction
class TestPerson(ERP5TypeTestCase):
......@@ -173,6 +176,22 @@ class TestPerson(ERP5TypeTestCase):
self.assertEquals(None, p.getPassword())
self.assertEquals('default', p.getPassword('default'))
def testPreferenceInteractionWorkflow(self, quiet=0, run=run_all_test):
""" Test copy/paste a Person object. """
if not run:
return
person_module = self.getPersonModule()
title = "Séb"
person = person_module.newContent(portal_type='Person', title=title)
person.setReference('test_seb')
transaction.commit()
self.tic()
portal = self.getPortal()
last_id = portal.portal_preferences.getLastId()
last_preference = portal.portal_preferences[last_id]
self.assertTrue("Séb" in last_preference.getTitle())
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestPerson))
......
......@@ -84,7 +84,7 @@ except ImportError:
getGlobalTranslationService = GlobalTranslationService
from Products.ERP5Type.Globals import get_request
from Products.ERP5Type import Globals
from cPickle import dumps, loads
try:
......@@ -135,7 +135,7 @@ class Message(Persistent):
the return value is a string object. If it is a unicode object,
the return value is a unicode object.
"""
request = get_request()
request = Globals.get_request()
if request is not None:
context = request['PARENTS'][0]
translation_service = getGlobalTranslationService()
......
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