[Erp5-report] r39180 seb - in /erp5/trunk/products: ERP5/tests/ ERP5Type/

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Oct 14 17:04:34 CEST 2010


Author: seb
Date: Thu Oct 14 17:04:32 2010
New Revision: 39180

URL: http://svn.erp5.org?rev=39180&view=rev
Log:
- 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

Modified:
    erp5/trunk/products/ERP5/tests/testPerson.py
    erp5/trunk/products/ERP5Type/Message.py

Modified: erp5/trunk/products/ERP5/tests/testPerson.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testPerson.py?rev=39180&r1=39179&r2=39180&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testPerson.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testPerson.py [utf8] Thu Oct 14 17:04:32 2010
@@ -1,3 +1,4 @@
+# -*- 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))

Modified: erp5/trunk/products/ERP5Type/Message.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/Message.py?rev=39180&r1=39179&r2=39180&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/Message.py [utf8] (original)
+++ erp5/trunk/products/ERP5Type/Message.py [utf8] Thu Oct 14 17:04:32 2010
@@ -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()




More information about the Erp5-report mailing list