Opened 13 years ago
Closed 12 years ago
#20194 closed Cleanup/optimization (fixed)
"console", "dummy", and "locmem" email backends should accept generators to send_messages() just as "smtp" backend does
| Reported by: | brendoncrawford | Owned by: | brendoncrawford |
|---|---|---|---|
| Component: | Core (Mail) | Version: | dev |
| Severity: | Normal | Keywords: | email, email backends, emailbackend |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
Change History (5)
comment:1 by , 13 years ago
| Needs tests: | set |
|---|
comment:2 by , 13 years ago
| Has patch: | set |
|---|---|
| Needs tests: | unset |
| Owner: | changed from to |
| Status: | new → assigned |
Github Pull Request is Here:
https://github.com/django/django/pull/991
Test:
from django.core.management.base import BaseCommand
from django.core import mail
class Command(BaseCommand):
help = 'Test for https://code.djangoproject.com/ticket/20194'
def handle(self, *args, **options):
mail_from = "root+foo@localhost"
msgs = [
("root+baz@localhost", "Test 1", "Test 1 Body"),
("root+baz@localhost", "Test 2", "Test 2 Body")
]
cb = lambda m: mail.EmailMessage(m[1], m[2], mail_from, [m[0]])
email_messages = (cb(m) for m in msgs)
conn = mail.get_connection()
conn.open()
sent_count = conn.send_messages(email_messages)
conn.close()
print("Sent: %d" % sent_count)
return ''
comment:3 by , 13 years ago
| Patch needs improvement: | set |
|---|
Your test must be integrated into the test suite.
An additional test_send_messages_generator method on the mail.tests.BaseEmailBackendTests class should do.
comment:4 by , 13 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
comment:5 by , 12 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
I am working on a patch, which I will submit via Github pull request soon.