Commit be52996e authored by Jérome Perrin's avatar Jérome Perrin

credential: stop using deprecated property for email

In 44e0b22f (Move to new API, detailed properties take precedence,
2011-09-09) we introduce a new data model for coordinates, in the case
of emails, we have "url_string" fro the "detailed" form and
"coordinate_text", for the "store what user entered" form.

In some places of erp5_credential, we use setDefaultEmailText, which
calls Coordinate.setText which uses the deprecated Coordinate.fromText,
which sets the same value for "url_string" and "coordinate_text", which
seems a questionnable behavior, because the data is saved twice and
some code might be using the wrong property.

This changes every usage to the new coordinate_text property
parent fd737b5f
Pipeline #26097 failed with stage
in 0 seconds
...@@ -13,7 +13,7 @@ person_mapping = ( ...@@ -13,7 +13,7 @@ person_mapping = (
('date_of_birth', 'birthday'), ('date_of_birth', 'birthday'),
('nationality', 'nationality'), ('nationality', 'nationality'),
('language', 'language'), ('language', 'language'),
('default_email_text', 'default_email_text'), ('default_email_coordinate_text', 'default_email_coordinate_text'),
('default_telephone_telephone_country', 'default_telephone_telephone_country'), ('default_telephone_telephone_country', 'default_telephone_telephone_country'),
('default_telephone_text', 'default_telephone_text'), ('default_telephone_text', 'default_telephone_text'),
('default_fax_text', 'default_fax_text'), ('default_fax_text', 'default_fax_text'),
......
...@@ -33,7 +33,7 @@ if default_email_text is not None: ...@@ -33,7 +33,7 @@ if default_email_text is not None:
message = "We have sent you an email containing your username(s). Please check your inbox and your junk/spam mail for this email." message = "We have sent you an email containing your username(s). Please check your inbox and your junk/spam mail for this email."
if web_site: if web_site:
document_reference = web_site.getCredentialUsernameRecoveryMessageReference() document_reference = web_site.getCredentialUsernameRecoveryMessageReference()
createCredentialRecovery(default_email_text=default_email_text, createCredentialRecovery(default_email_coordinate_text=default_email_text,
destination_decision_value_list=person_list, destination_decision_value_list=person_list,
document_reference=document_reference, document_reference=document_reference,
language=portal.Localizer.get_selected_language()) language=portal.Localizer.get_selected_language())
......
...@@ -23,7 +23,7 @@ credential_request = module.newContent( ...@@ -23,7 +23,7 @@ credential_request = module.newContent(
default_credential_question_question=default_credential_question_question, default_credential_question_question=default_credential_question_question,
default_credential_question_question_free_text=default_credential_question_question_free_text, default_credential_question_question_free_text=default_credential_question_question_free_text,
default_credential_question_answer=default_credential_question_answer, default_credential_question_answer=default_credential_question_answer,
default_email_text=default_email_text, default_email_coordinate_text=default_email_text,
default_telephone_text=default_telephone_text, default_telephone_text=default_telephone_text,
default_mobile_telephone_text=default_mobile_telephone_text, default_mobile_telephone_text=default_mobile_telephone_text,
default_fax_text=default_fax_text, default_fax_text=default_fax_text,
......
...@@ -403,6 +403,8 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -403,6 +403,8 @@ class TestERP5Credential(ERP5TypeTestCase):
person = person_result[0].getObject() person = person_result[0].getObject()
self.assertEqual(person.getTitle(), 'Homer Simpson') self.assertEqual(person.getTitle(), 'Homer Simpson')
self.assertEqual(person.getDefaultEmailText(), 'homer.simpson@fox.com') self.assertEqual(person.getDefaultEmailText(), 'homer.simpson@fox.com')
# the obsolete email property is not used
self.assertIsNone(person.getDefaultEmailUrlString())
# check homie can log in the system # check homie can log in the system
self._assertUserExists('homie', 'secret') self._assertUserExists('homie', 'secret')
...@@ -429,7 +431,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -429,7 +431,7 @@ class TestERP5Credential(ERP5TypeTestCase):
last_name='Simpsons', # add a 's' to the end of the last_name last_name='Simpsons', # add a 's' to the end of the last_name
reference='homie', reference='homie',
password='new_password', password='new_password',
default_email_text='homie.simpsons@fox.com', default_email_coordinate_text='homie.simpsons@fox.com',
destination_decision=homie.getRelativeUrl()) destination_decision=homie.getRelativeUrl())
credential_update.submit() credential_update.submit()
...@@ -456,6 +458,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -456,6 +458,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual(related_person.getLastName(), 'Simpsons') self.assertEqual(related_person.getLastName(), 'Simpsons')
self.assertEqual(related_person.getDefaultEmailText(), self.assertEqual(related_person.getDefaultEmailText(),
'homie.simpsons@fox.com') 'homie.simpsons@fox.com')
self.assertIsNone(related_person.getDefaultEmailUrlString())
def stepCreateSubscriptionRequestWithSecurityQuestionCategory(self, sequence=None, def stepCreateSubscriptionRequestWithSecurityQuestionCategory(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -544,7 +547,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -544,7 +547,7 @@ class TestERP5Credential(ERP5TypeTestCase):
person = person_module.newContent(title='Barney', person = person_module.newContent(title='Barney',
reference='barney', reference='barney',
start_date=DateTime('1970/01/01'), start_date=DateTime('1970/01/01'),
default_email_text='barney@duff.com') default_email_coordinate_text='barney@duff.com')
# create an assignment # create an assignment
assignment = person.newContent(portal_type='Assignment', assignment = person.newContent(portal_type='Assignment',
function='member') function='member')
...@@ -862,6 +865,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -862,6 +865,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual("Homer", person.getFirstName()) self.assertEqual("Homer", person.getFirstName())
self.assertEqual("Simpson", person.getLastName()) self.assertEqual("Simpson", person.getLastName())
self.assertEqual("homer.simpson@fox.com", person.getDefaultEmailText()) self.assertEqual("homer.simpson@fox.com", person.getDefaultEmailText())
self.assertIsNone(person.getDefaultEmailUrlString())
self.assertEqual(DateTime('1970/01/01'), person.getStartDate()) self.assertEqual(DateTime('1970/01/01'), person.getStartDate())
self.logout() self.logout()
...@@ -878,6 +882,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -878,6 +882,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual("tom", person.getFirstName()) self.assertEqual("tom", person.getFirstName())
self.assertEqual("Simpson", person.getLastName()) self.assertEqual("Simpson", person.getLastName())
self.assertEqual("tom@host.com", person.getDefaultEmailText()) self.assertEqual("tom@host.com", person.getDefaultEmailText())
self.assertIsNone(person.getDefaultEmailUrlString())
self.assertEqual(DateTime('1970/01/01'), person.getStartDate()) self.assertEqual(DateTime('1970/01/01'), person.getStartDate())
def stepCheckPersonWhenCredentialUpdateFail(self, sequence=None, def stepCheckPersonWhenCredentialUpdateFail(self, sequence=None,
...@@ -1138,6 +1143,7 @@ class TestERP5Credential(ERP5TypeTestCase): ...@@ -1138,6 +1143,7 @@ class TestERP5Credential(ERP5TypeTestCase):
self.assertEqual(credential_request.getFirstName(), "Barney") self.assertEqual(credential_request.getFirstName(), "Barney")
self.assertEqual(credential_request.getDefaultEmailText(), self.assertEqual(credential_request.getDefaultEmailText(),
"barney@duff.com") "barney@duff.com")
self.assertIsNone(credential_request.getDefaultEmailUrlString())
self.assertEqual(credential_request.getRole(), "internal") self.assertEqual(credential_request.getRole(), "internal")
self.assertEqual(credential_request.getFunction(), "member") self.assertEqual(credential_request.getFunction(), "member")
......
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