Author: russellm
Date: 2010-10-12 09:06:11 -0500 (Tue, 12 Oct 2010)
New Revision: 14187
Modified:
django/trunk/tests/modeltests/test_client/views.py
Log:
Modified the test_client tests to use the non-deprecated mail API.
Modified: django/trunk/tests/modeltests/test_client/views.py
===================================================================
--- django/trunk/tests/modeltests/test_client/views.py 2010-10-12 07:53:37 UTC
(rev 14186)
+++ django/trunk/tests/modeltests/test_client/views.py 2010-10-12 14:06:11 UTC
(rev 14187)
@@ -1,6 +1,6 @@
from xml.dom.minidom import parseString
-from django.core.mail import EmailMessage, SMTPConnection
+from django.core import mail
from django.template import Context, Template
from django.http import HttpResponse, HttpResponseRedirect,
HttpResponseNotFound
from django.contrib.auth.decorators import login_required, permission_required
@@ -38,7 +38,7 @@
response = HttpResponse()
response['X-DJANGO-TEST'] = 'Slartibartfast'
return response
-
+
def raw_post_view(request):
"""A view which expects raw XML to be posted and returns content extracted
from the XML"""
@@ -139,7 +139,7 @@
"A simple view that is login protected with a custom redirect field set"
t = Template('This is a login protected test. Username is {{ user.username
}}.', name='Login Template')
c = Context({'user': request.user})
-
+
return HttpResponse(t.render(c))
login_protected_view_changed_redirect =
login_required(redirect_field_name="redirect_to")(login_protected_view_changed_redirect)
@@ -189,7 +189,7 @@
raise KeyError("Oops! Looks like you wrote some bad code.")
def mail_sending_view(request):
- EmailMessage(
+ mail.EmailMessage(
"Test message",
"This is a test email",
"[email protected]",
@@ -197,18 +197,18 @@
return HttpResponse("Mail sent")
def mass_mail_sending_view(request):
- m1 = EmailMessage(
+ m1 = mail.EmailMessage(
'First Test message',
'This is the first test email',
'[email protected]',
['[email protected]', '[email protected]'])
- m2 = EmailMessage(
+ m2 = mail.EmailMessage(
'Second Test message',
'This is the second test email',
'[email protected]',
['[email protected]', '[email protected]'])
- c = SMTPConnection()
+ c = mail.get_connection()
c.send_messages([m1,m2])
return HttpResponse("Mail sent")
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.