You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2016/09/06 14:50:40 UTC
[07/10] allura git commit: [#8117] apply new mail helper to other
places, so they get nicer From address display
[#8117] apply new mail helper to other places, so they get nicer From address display
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/52d6d52c
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/52d6d52c
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/52d6d52c
Branch: refs/heads/master
Commit: 52d6d52c0defd155a95f8038073882ff6558e782
Parents: a5aba37
Author: Dave Brondsema <da...@brondsema.net>
Authored: Thu Sep 1 10:30:45 2016 -0400
Committer: Dave Brondsema <da...@brondsema.net>
Committed: Tue Sep 6 10:38:52 2016 -0400
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 9 +--------
Allura/allura/model/auth.py | 10 +++-------
Allura/allura/tasks/export_tasks.py | 14 +++-----------
Allura/allura/tests/functional/test_auth.py | 3 ++-
Allura/allura/tests/functional/test_site_admin.py | 3 ++-
Allura/allura/tests/test_tasks.py | 2 +-
6 files changed, 12 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/52d6d52c/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 42840d2..669f81f 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -214,14 +214,7 @@ class AuthController(BaseController):
config=config,
hash=hash,
))
-
- allura.tasks.mail_tasks.sendsimplemail.post(
- toaddr=email_record.email,
- fromaddr=config['forgemail.return_path'],
- reply_to=config['forgemail.return_path'],
- subject=subject,
- message_id=h.gen_message_id(),
- text=text)
+ send_system_mail_to_user(email_record.email, subject, text)
h.auditlog_user('Password recovery link sent to: %s', email, user=user_record)
flash(message)
redirect('/')
http://git-wip-us.apache.org/repos/asf/allura/blob/52d6d52c/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index c1c8235..32b419a 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -188,13 +188,9 @@ class EmailAddress(MappedClass):
config=config
))
- allura.tasks.mail_tasks.sendsimplemail.post(
- toaddr=self.email,
- fromaddr=config['forgemail.return_path'],
- reply_to=config['forgemail.return_path'],
- subject=u'%s - Email address claim attempt' % config['site_name'],
- message_id=h.gen_message_id(),
- text=text)
+ allura.tasks.mail_tasks.send_system_mail_to_user(self.email,
+ u'%s - Email address claim attempt' % config['site_name'],
+ text)
def set_nonce_hash(self):
self.nonce = sha256(os.urandom(10)).hexdigest()
http://git-wip-us.apache.org/repos/asf/allura/blob/52d6d52c/Allura/allura/tasks/export_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tasks/export_tasks.py b/Allura/allura/tasks/export_tasks.py
index 9e2d73e..87fcc8b 100644
--- a/Allura/allura/tasks/export_tasks.py
+++ b/Allura/allura/tasks/export_tasks.py
@@ -84,17 +84,9 @@ class BulkExport(object):
'not_exported_tools': list(set(tools) - set(exported_names)),
}
- email = {
- 'toaddr': unicode(user._id),
- 'fromaddr': unicode(tg.config['forgemail.return_path']),
- 'sender': unicode(tg.config['forgemail.return_path']),
- 'reply_to': unicode(tg.config['forgemail.return_path']),
- 'message_id': h.gen_message_id(),
- 'subject': u'Bulk export for project %s completed' % project.shortname,
- 'text': tmpl.render(tmpl_context)
- }
-
- mail_tasks.sendsimplemail.post(**email)
+ mail_tasks.send_system_mail_to_user(user,
+ u'Bulk export for project %s completed' % project.shortname,
+ tmpl.render(tmpl_context))
def get_export_path(self, export_base_path, export_filename):
"""Create temporary directory for export files"""
http://git-wip-us.apache.org/repos/asf/allura/blob/52d6d52c/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index a50a13a..828d207 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -1368,8 +1368,9 @@ To reset your password on %s, please visit the following URL:
%s/auth/forgotten_password/%s''' % (config['site_name'], config['base_url'], hash)
sendmail.post.assert_called_once_with(
+ sender='noreply@localhost',
toaddr=email.email,
- fromaddr=config['forgemail.return_path'],
+ fromaddr=u'"{}" <{}>'.format(config['site_name'], config['forgemail.return_path']),
reply_to=config['forgemail.return_path'],
subject='Allura Password recovery',
message_id=gen_message_id(),
http://git-wip-us.apache.org/repos/asf/allura/blob/52d6d52c/Allura/allura/tests/functional/test_site_admin.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_site_admin.py b/Allura/allura/tests/functional/test_site_admin.py
index d4e96a0..64c2dbb 100644
--- a/Allura/allura/tests/functional/test_site_admin.py
+++ b/Allura/allura/tests/functional/test_site_admin.py
@@ -709,8 +709,9 @@ To reset your password on %s, please visit the following URL:
%s/auth/forgotten_password/%s''' % (config['site_name'], config['base_url'], hash)
sendmail.post.assert_called_once_with(
+ sender='noreply@localhost',
toaddr='test-user@example.org',
- fromaddr=config['forgemail.return_path'],
+ fromaddr=u'"{}" <{}>'.format(config['site_name'], config['forgemail.return_path']),
reply_to=config['forgemail.return_path'],
subject='Allura Password recovery',
message_id=gen_message_id(),
http://git-wip-us.apache.org/repos/asf/allura/blob/52d6d52c/Allura/allura/tests/test_tasks.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_tasks.py b/Allura/allura/tests/test_tasks.py
index abf22c2..525e7e3 100644
--- a/Allura/allura/tests/test_tasks.py
+++ b/Allura/allura/tests/test_tasks.py
@@ -567,7 +567,7 @@ class TestExportTasks(unittest.TestCase):
assert_equal(len(tasks), 1)
assert_equal(tasks[0].kwargs['subject'],
'Bulk export for project test completed')
- assert_equal(tasks[0].kwargs['fromaddr'], g.noreply)
+ assert_equal(tasks[0].kwargs['fromaddr'], '"Allura" <no...@localhost>')
assert_equal(tasks[0].kwargs['reply_to'], g.noreply)
text = tasks[0].kwargs['text']
assert_in('The bulk export for project test is completed.', text)