Changes between Initial Version and Version 1 of Ticket #13641


Ignore:
Timestamp:
05/27/2010 03:25:24 PM (5 years ago)
Author:
kmtracey
Comment:

Fixed formatting; please use preview.

You seem to be looking at the doc for Django 1.2 (or current trunk) while using Django 1.1.1. get_connection is mentioned under the doc for email backends, which is flagged as new in 1.2: http://docs.djangoproject.com/en/dev/topics/email/#e-mail-backends. This function does exist in Django 1.2:

>>> import django
>>> django.get_version()
'1.2.1'
>>> from django.core.mail import get_connection
>>>

django.core.mail.get_connection did not exist in 1.1 and is not mentioned in the 1.1 version of the doc (http://docs.djangoproject.com/en/1.1/topics/email/).

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13641

    • Property Status changed from new to closed
    • Property Patch needs improvement unset
    • Property Needs tests unset
    • Property Needs documentation unset
    • Property Resolution changed from to invalid
  • Ticket #13641 – Description

    initial v1  
    11If we try to import the get_connection() function from django.core.mail as specified in the documentation we get the following ImportError in Django 1.1.1:
    2 
     2{{{
    33Python 2.6.4 (r264:75706, Dec  7 2009, 18:43:55)
    44[GCC 4.4.1] on linux2
     
    99  File "<console>", line 1, in <module>
    1010ImportError: cannot import name get_connection
    11 
     11}}}
    1212Looking at the source code of the module situated at /usr/local/lib/python2.6/dist-packages/django/core/mail.py we can check that no get_connection() is declared in the module.
    1313If we want to create a connection to send emails, we have to instantiate the SMTPConnection class and then call its methods. For example:
    14 
     14{{{
    1515mailConnection = SMTPConnection()
    1616mailConnection.open()
    1717mailConnection.send_messages([email1, email2])
    1818mailConnection.close()
    19 
     19}}}
    2020get_connection(self, fail_silently=False) is a method inside the EmailMessage class situated in line 228 and used in line 266, not a function.
    2121
Back to Top