Commit 9cc2191c authored by Romain Courteaud's avatar Romain Courteaud

fixup! fix middle name handling in Person.

Person.getTitle used to return first/last name properties when defined, as the title property was always dropped.

This fixes nexedi/erp5@2155dbf5
parent 316e1147
......@@ -87,7 +87,6 @@ class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin):
Returns the title if it exists or a combination of
first name, middle name and last name
"""
if not self.title:
title = ' '.join([x for x in (self.getFirstName(),
self.getMiddleName(),
self.getLastName()) if x])
......@@ -102,7 +101,6 @@ class Person(Node, LoginAccountProviderMixin, EncryptedPasswordMixin):
Returns the title if it exists or a combination of
first name, middle name and last name
"""
if not self.title:
title = ' '.join([x for x in (self.getTranslatedFirstName(**kw),
self.getTranslatedMiddleName(**kw),
self.getTranslatedLastName(**kw)) if x])
......
......@@ -174,9 +174,9 @@ class TestPerson(ERP5TypeTestCase):
p.edit( first_name='first',
last_name='last',
title='title' )
self.assertEqual('title', p.getTitle())
self.assertEqual('first last', p.getTitle())
p.edit(middle_name='middle')
self.assertEqual('title', p.getTitle())
self.assertEqual('first middle last', p.getTitle())
def testGetTitleOrId(self):
p = self._makeOne(id='person')
......
  • @romain @kazuhiko This change seem to introduce a test failure https://nexedi.erp5.net/test_result_module/20160530-164D738F/224

    I feel we are lacking a test like this one:

      def test_PersonGetTitleDefined(self):
        p = self._makeOne(title="title")
        self.assertEqual("title", p.getTitle())

    but please confirm this is expected behavior.

  • For reference, the test failure from previous message was addressed as 80c30ea0 and the test_PersonGetTitleDefined was added as 80c30ea0

    This change which gives priority to First Name and Last Name even when Title is set solves https://nexedi.erp5.net/bug_module/20160115-CD8FF4

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