Commit 43b1531d authored by Kazuhiko Shiozaki's avatar Kazuhiko Shiozaki

use prefered_sender_section for credential related messages if exist.

parent 37298336
...@@ -73,8 +73,13 @@ if context.hasStopDate():\n ...@@ -73,8 +73,13 @@ if context.hasStopDate():\n
else:\n else:\n
kw = {}\n kw = {}\n
\n \n
sender = portal.portal_preferences.getPreferredSenderSection()\n
if sender is not None:\n
sender = portal.restrictedTraverse(sender)\n
\n
portal.portal_password.mailPasswordResetRequest(user_login=reference,\n portal.portal_password.mailPasswordResetRequest(user_login=reference,\n
REQUEST=context.REQUEST,\n REQUEST=context.REQUEST,\n
sender=sender,\n
notification_message=notification_message,\n notification_message=notification_message,\n
store_as_event=portal.portal_preferences.isPreferredStoreEvents(),\n store_as_event=portal.portal_preferences.isPreferredStoreEvents(),\n
**kw)\n **kw)\n
......
...@@ -63,8 +63,11 @@ for person in person_list:\n ...@@ -63,8 +63,11 @@ for person in person_list:\n
usernames = " ".join(usernames)\n usernames = " ".join(usernames)\n
\n \n
reference_list = [x.getReference() for x in person_list]\n reference_list = [x.getReference() for x in person_list]\n
message_reference = portal.portal_preferences.getPreferredCredentialUsernameRecoveryMessageReference()\n if context.hasDocumentReference():\n
if message_reference is None:\n message_reference = context.getDocumentReference()\n
else:\n
message_reference = portal.portal_preferences.getPreferredCredentialUsernameRecoveryMessageReference()\n
if message_reference is None:\n
raise ValueError, "Preference not configured"\n raise ValueError, "Preference not configured"\n
\n \n
notification_message = portal.NotificationTool_getDocumentValue(message_reference,\n notification_message = portal.NotificationTool_getDocumentValue(message_reference,\n
...@@ -80,7 +83,12 @@ else:\n ...@@ -80,7 +83,12 @@ else:\n
\n \n
subject = notification_message.asSubjectText(substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n subject = notification_message.asSubjectText(substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
\n \n
sender = portal.portal_preferences.getPreferredSenderSection()\n
if sender is not None:\n
sender = portal.restrictedTraverse(sender)\n
\n
portal.portal_notifications.sendMessage(\n portal.portal_notifications.sendMessage(\n
sender=sender,\n
recipient=person_list,\n recipient=person_list,\n
subject=subject,\n subject=subject,\n
message=mail_text,\n message=mail_text,\n
......
...@@ -85,8 +85,12 @@ else:\n ...@@ -85,8 +85,12 @@ else:\n
substitution_method_parameter_dict={\'mapping_dict\':notification_mapping_dict})\n substitution_method_parameter_dict={\'mapping_dict\':notification_mapping_dict})\n
\n \n
#Send email\n #Send email\n
sender = portal.portal_preferences.getPreferredSenderSection()\n
if sender is not None:\n
sender = portal.restrictedTraverse(sender)\n
\n
portal.portal_notifications.sendMessage(\n portal.portal_notifications.sendMessage(\n
sender=None,\n sender=sender,\n
recipient=recipient,\n recipient=recipient,\n
subject=notification_message.getTitle(),\n subject=notification_message.getTitle(),\n
message=mail_text,\n message=mail_text,\n
......
...@@ -60,9 +60,10 @@ Member -- Use mailhost service\n ...@@ -60,9 +60,10 @@ Member -- Use mailhost service\n
"""\n """\n
\n \n
from random import randint\n from random import randint\n
portal = context.getPortalObject()\n
\n \n
#Get message\n #Get message\n
notification_message = context.portal_catalog.getResultValue(portal_type="Notification Message",\n notification_message = portal.portal_catalog.getResultValue(portal_type="Notification Message",\n
reference=notification_reference)\n reference=notification_reference)\n
notification_message_reference = randint(0, 999**9)\n notification_message_reference = randint(0, 999**9)\n
\n \n
...@@ -79,7 +80,12 @@ else:\n ...@@ -79,7 +80,12 @@ else:\n
mail_text = notification_message.asText(\n mail_text = notification_message.asText(\n
substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n substitution_method_parameter_dict={\'mapping_dict\':mapping_dict})\n
\n \n
context.portal_notifications.sendMessage(\n sender = portal.portal_preferences.getPreferredSenderSection()\n
if sender is not None:\n
sender = portal.restrictedTraverse(sender)\n
\n
portal.portal_notifications.sendMessage(\n
sender=sender,\n
recipient=(context,),\n recipient=(context,),\n
subject=notification_message.getTitle(),\n subject=notification_message.getTitle(),\n
message=mail_text,\n message=mail_text,\n
......
2012-05-01 Kazuhiko
* use prefered_sender_section for credential related messages if exist.
2012-04-27 Kazuhiko 2012-04-27 Kazuhiko
* use document_reference in Credential Recovery as the reference of nofitication message if exists. * use document_reference in Credential Recovery as the reference of nofitication message if exists.
......
415 416
\ No newline at end of file \ No newline at end of file
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