Ticket #9345: fixes.patch
File fixes.patch, 22.0 KB (added by , 16 years ago) |
---|
-
django/conf/global_settings.py
178 178 # the site managers. 179 179 DEFAULT_FROM_EMAIL = 'webmaster@localhost' 180 180 181 # Subject-line prefix for e mail messages send with django.core.mail.mail_admins181 # Subject-line prefix for e-mail messages send with django.core.mail.mail_admins 182 182 # or ...mail_managers. Make sure to include the trailing space. 183 183 EMAIL_SUBJECT_PREFIX = '[Django] ' 184 184 -
django/contrib/auth/management/commands/createsuperuser.py
27 27 make_option('--username', dest='username', default=None, 28 28 help='Specifies the username for the superuser.'), 29 29 make_option('--email', dest='email', default=None, 30 help='Specifies the e mail address for the superuser.'),30 help='Specifies the e-mail address for the superuser.'), 31 31 make_option('--noinput', action='store_false', dest='interactive', default=True, 32 32 help='Tells Django to NOT prompt the user for input of any kind. ' \ 33 33 'You must use --username and --email with --noinput, and ' \ … … 50 50 try: 51 51 is_valid_email(email) 52 52 except exceptions.ValidationError: 53 raise CommandError("Invalid e mail address.")53 raise CommandError("Invalid e-mail address.") 54 54 55 55 password = '' 56 56 … … 100 100 sys.stderr.write("Error: That username is already taken.\n") 101 101 username = None 102 102 103 # Get an e mail103 # Get an e-mail 104 104 while 1: 105 105 if not email: 106 106 email = raw_input('E-mail address: ') -
django/contrib/auth/tests/views.py
12 12 urls = 'django.contrib.auth.urls' 13 13 14 14 def test_email_not_found(self): 15 "Error is raised if the provided e mail address isn't currently registered"15 "Error is raised if the provided e-mail address isn't currently registered" 16 16 response = self.client.get('/password_reset/') 17 17 self.assertEquals(response.status_code, 200) 18 18 response = self.client.post('/password_reset/', {'email': 'not_a_real_email@email.com'}) … … 20 20 self.assertEquals(len(mail.outbox), 0) 21 21 22 22 def test_email_found(self): 23 "E mail is sent if a valid email address is provided for password reset"23 "E-mail is sent if a valid e-mail address is provided for password reset" 24 24 response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'}) 25 25 self.assertEquals(response.status_code, 302) 26 26 self.assertEquals(len(mail.outbox), 1) 27 27 self.assert_("http://" in mail.outbox[0].body) 28 28 29 29 def _test_confirm_start(self): 30 # Start by creating the e mail30 # Start by creating the e-mail 31 31 response = self.client.post('/password_reset/', {'email': 'staffmember@example.com'}) 32 32 self.assertEquals(response.status_code, 302) 33 33 self.assertEquals(len(mail.outbox), 1) … … 35 35 36 36 def _read_signup_email(self, email): 37 37 urlmatch = re.search(r"https?://[^/]*(/.*reset/\S*)", email.body) 38 self.assert_(urlmatch is not None, "No URL found in sent e mail")38 self.assert_(urlmatch is not None, "No URL found in sent e-mail") 39 39 return urlmatch.group(), urlmatch.groups()[0] 40 40 41 41 def test_confirm_valid(self): -
django/contrib/comments/forms.py
17 17 18 18 class CommentForm(forms.Form): 19 19 name = forms.CharField(label=_("Name"), max_length=50) 20 email = forms.EmailField(label=_("E mail address"))20 email = forms.EmailField(label=_("E-mail address")) 21 21 url = forms.URLField(label=_("URL"), required=False) 22 22 comment = forms.CharField(label=_('Comment'), widget=forms.Textarea, 23 23 max_length=COMMENT_MAX_LENGTH) -
django/contrib/comments/models.py
48 48 # was posted by a non-authenticated user. 49 49 user = models.ForeignKey(User, blank=True, null=True, related_name="%(class)s_comments") 50 50 user_name = models.CharField(_("user's name"), max_length=50, blank=True) 51 user_email = models.EmailField(_("user's e mail address"), blank=True)51 user_email = models.EmailField(_("user's e-mail address"), blank=True) 52 52 user_url = models.URLField(_("user's URL"), blank=True) 53 53 54 54 comment = models.TextField(_('comment'), max_length=COMMENT_MAX_LENGTH) … … 122 122 def _set_email(self, val): 123 123 if self.user_id: 124 124 raise AttributeError(_("This comment was posted by an authenticated "\ 125 "user and thus the e mail is read-only."))125 "user and thus the e-mail is read-only.")) 126 126 self.user_email = val 127 email = property(_get_email, _set_email, doc="The e mail of the user who posted this comment")127 email = property(_get_email, _set_email, doc="The e-mail of the user who posted this comment") 128 128 129 129 def _get_url(self): 130 130 return self.userinfo["url"] … … 137 137 138 138 def get_as_text(self): 139 139 """ 140 Return this comment as plain text. Useful for emails.140 Return this comment as plain text. Useful for e-mails. 141 141 """ 142 142 d = { 143 143 'user': self.user, -
django/contrib/comments/templates/comments/moderation_queue.html
33 33 <th>{% trans "Action" %}</th> 34 34 <th>{% trans "Name" %}</th> 35 35 <th>{% trans "Comment" %}</th> 36 <th>{% trans "E mail" %}</th>36 <th>{% trans "E-mail" %}</th> 37 37 <th>{% trans "URL" %}</th> 38 38 <th>{% trans "Authenticated?" %}</th> 39 <th>{% trans "IP Address" %}</th>39 <th>{% trans "IP address" %}</th> 40 40 <th class="sorted desc">{% trans "Date posted" %}</th> 41 41 </tr> 42 42 </thead> … … 60 60 <td> 61 61 <img 62 62 src="{% admin_media_prefix %}img/admin/icon-{% if comment.user %}yes{% else %}no{% endif %}.gif" 63 alt="{% if comment.user %}{% trans " yes" %}{% else %}{% trans "no" %}{% endif %}"63 alt="{% if comment.user %}{% trans "Yes" %}{% else %}{% trans "No" %}{% endif %}" 64 64 /> 65 65 </td> 66 66 <td>{{ comment.ip_address }}</td> -
django/contrib/comments/templates/comments/preview.html
7 7 {% load comments %} 8 8 <form action="{% comment_form_target %}" method="post"> 9 9 {% if form.errors %} 10 <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below {% plural %}Please correct the errors below{% endblocktrans %}</h1>10 <h1>{% blocktrans count form.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}</h1> 11 11 {% else %} 12 12 <h1>{% trans "Preview your comment" %}</h1> 13 13 <blockquote>{{ comment|linebreaks }}</blockquote> -
django/core/mail.py
1 1 """ 2 Tools for sending e mail.2 Tools for sending e-mail. 3 3 """ 4 4 5 5 import mimetypes … … 118 118 119 119 def open(self): 120 120 """ 121 Ensures we have a connection to the e mail server. Returns whether or121 Ensures we have a connection to the e-mail server. Returns whether or 122 122 not a new connection was required (True or False). 123 123 """ 124 124 if self.connection: … … 141 141 raise 142 142 143 143 def close(self): 144 """Closes the connection to the e mail server."""144 """Closes the connection to the e-mail server.""" 145 145 try: 146 146 try: 147 147 self.connection.quit() … … 158 158 159 159 def send_messages(self, email_messages): 160 160 """ 161 Sends one or more EmailMessage objects and returns the number of e mail161 Sends one or more EmailMessage objects and returns the number of e-mail 162 162 messages sent. 163 163 """ 164 164 if not email_messages: … … 201 201 def __init__(self, subject='', body='', from_email=None, to=None, bcc=None, 202 202 connection=None, attachments=None, headers=None): 203 203 """ 204 Initialize a single e mail message (which can be sent to multiple204 Initialize a single e-mail message (which can be sent to multiple 205 205 recipients). 206 206 207 207 All strings used to create the message can be unicode strings (or UTF-8 … … 248 248 msg['From'] = self.from_email 249 249 msg['To'] = ', '.join(self.to) 250 250 251 # E mail header names are case-insensitive (RFC 2045), so we have to251 # E-mail header names are case-insensitive (RFC 2045), so we have to 252 252 # accommodate that when doing comparisons. 253 253 header_names = [key.lower() for key in self.extra_headers] 254 254 if 'date' not in header_names: … … 261 261 262 262 def recipients(self): 263 263 """ 264 Returns a list of all recipients of the e mail (includes direct264 Returns a list of all recipients of the e-mail (includes direct 265 265 addressees as well as Bcc entries). 266 266 """ 267 267 return self.to + self.bcc 268 268 269 269 def send(self, fail_silently=False): 270 """Sends the e mail message."""270 """Sends the e-mail message.""" 271 271 return self.get_connection(fail_silently).send_messages([self]) 272 272 273 273 def attach(self, filename=None, content=None, mimetype=None): -
django/test/utils.py
16 16 17 17 class TestSMTPConnection(object): 18 18 """A substitute SMTP connection for use during test sessions. 19 The test connection stores e mail messages in a dummy outbox,19 The test connection stores e-mail messages in a dummy outbox, 20 20 rather than sending them out on the wire. 21 22 21 """ 23 22 def __init__(*args, **kwargs): 24 23 pass … … 37 36 """Perform any global pre-test setup. This involves: 38 37 39 38 - Installing the instrumented test renderer 40 - Diverting the e mail sending functions to a test buffer39 - Diverting the e-mail sending functions to a test buffer 41 40 - Setting the active locale to match the LANGUAGE_CODE setting. 42 41 """ 43 42 Template.original_render = Template.render … … 54 53 """Perform any global post-test teardown. This involves: 55 54 56 55 - Restoring the original test renderer 57 - Restoring the email sending functions 58 56 - Restoring the e-mail sending functions 59 57 """ 60 58 Template.render = Template.original_render 61 59 del Template.original_render -
django/utils/feedgenerator.py
25 25 from django.utils.encoding import force_unicode, iri_to_uri 26 26 27 27 def rfc2822_date(date): 28 # We do this ourselves to be timezone aware, e mail.Utils is not tz aware.28 # We do this ourselves to be timezone aware, e-mail. Utils is not tz aware. 29 29 if date.tzinfo: 30 30 time_str = date.strftime('%a, %d %b %Y %H:%M:%S ') 31 31 offset = date.tzinfo.utcoffset(date) -
docs/howto/error-reporting.txt
11 11 However, running with :setting:`DEBUG` set to ``False`` means you'll never see 12 12 errors generated by your site -- everyone will just see your public error pages. 13 13 You need to keep track of errors that occur in deployed sites, so Django can be 14 configured to e mail you details of those errors.14 configured to e-mail you details of those errors. 15 15 16 16 Server errors 17 17 ------------- … … 29 29 404 errors 30 30 ---------- 31 31 32 Django can also be configured to e mail errors about broken links (404 "page33 not found" errors). Django sends e mails about 404 errors when:32 Django can also be configured to e-mail errors about broken links (404 "page 33 not found" errors). Django sends e-mails about 404 errors when: 34 34 35 35 * :setting:`DEBUG` is ``False`` 36 36 -
docs/ref/forms/validation.txt
154 154 class MultiEmailField(forms.Field): 155 155 def clean(self, value): 156 156 """ 157 Check that the field contains one or more comma-separated e mails158 and normalizes the data to a list of the e mail strings.157 Check that the field contains one or more comma-separated e-mails 158 and normalizes the data to a list of the e-mail strings. 159 159 """ 160 160 if not value: 161 161 raise forms.ValidationError('Enter at least one e-mail address.') -
docs/topics/forms/index.txt
218 218 </div> 219 219 <div class="fieldWrapper"> 220 220 {{ form.sender.errors }} 221 <label for="id_sender">Your e mail address:</label>221 <label for="id_sender">Your e-mail address:</label> 222 222 {{ form.sender }} 223 223 </div> 224 224 <div class="fieldWrapper"> -
tests/modeltests/test_client/models.py
177 177 "POST erroneous data to a form" 178 178 post_data = { 179 179 'text': 'Hello World', 180 'email': 'not an e mail address',180 'email': 'not an e-mail address', 181 181 'value': 37, 182 182 'single': 'b', 183 183 'multi': ('b','c','e') … … 388 388 389 389 self.assertEqual(len(mail.outbox), 1) 390 390 self.assertEqual(mail.outbox[0].subject, 'Test message') 391 self.assertEqual(mail.outbox[0].body, 'This is a test e mail')391 self.assertEqual(mail.outbox[0].body, 'This is a test e-mail') 392 392 self.assertEqual(mail.outbox[0].from_email, 'from@example.com') 393 393 self.assertEqual(mail.outbox[0].to[0], 'first@example.com') 394 394 self.assertEqual(mail.outbox[0].to[1], 'second@example.com') … … 401 401 402 402 self.assertEqual(len(mail.outbox), 2) 403 403 self.assertEqual(mail.outbox[0].subject, 'First Test message') 404 self.assertEqual(mail.outbox[0].body, 'This is the first test e mail')404 self.assertEqual(mail.outbox[0].body, 'This is the first test e-mail') 405 405 self.assertEqual(mail.outbox[0].from_email, 'from@example.com') 406 406 self.assertEqual(mail.outbox[0].to[0], 'first@example.com') 407 407 self.assertEqual(mail.outbox[0].to[1], 'second@example.com') 408 408 409 409 self.assertEqual(mail.outbox[1].subject, 'Second Test message') 410 self.assertEqual(mail.outbox[1].body, 'This is the second test e mail')410 self.assertEqual(mail.outbox[1].body, 'This is the second test e-mail') 411 411 self.assertEqual(mail.outbox[1].from_email, 'from@example.com') 412 412 self.assertEqual(mail.outbox[1].to[0], 'second@example.com') 413 413 self.assertEqual(mail.outbox[1].to[1], 'third@example.com') -
tests/modeltests/test_client/views.py
184 184 def mail_sending_view(request): 185 185 EmailMessage( 186 186 "Test message", 187 "This is a test e mail",187 "This is a test e-mail", 188 188 "from@example.com", 189 189 ['first@example.com', 'second@example.com']).send() 190 190 return HttpResponse("Mail sent") … … 192 192 def mass_mail_sending_view(request): 193 193 m1 = EmailMessage( 194 194 'First Test message', 195 'This is the first test e mail',195 'This is the first test e-mail', 196 196 'from@example.com', 197 197 ['first@example.com', 'second@example.com']) 198 198 m2 = EmailMessage( 199 199 'Second Test message', 200 'This is the second test e mail',200 'This is the second test e-mail', 201 201 'from@example.com', 202 202 ['second@example.com', 'third@example.com']) 203 203 -
tests/regressiontests/forms/extra.py
440 440 >>> print f.as_p() 441 441 <p>Name: <input type="text" name="name" maxlength="50" /></p> 442 442 <div class="errorlist"><div class="error">Enter a valid e-mail address.</div></div> 443 <p>E mail: <input type="text" name="email" value="invalid" /></p>443 <p>E-mail: <input type="text" name="email" value="invalid" /></p> 444 444 <div class="errorlist"><div class="error">This field is required.</div></div> 445 445 <p>Comment: <input type="text" name="comment" /></p> 446 446 -
tests/regressiontests/templates/filters.py
134 134 'filter-urlize06': ('{{ a|urlize }}', {"a": "<script>alert('foo')</script>"}, '<script>alert('foo')</script>'), 135 135 136 136 # mailto: testing for urlize 137 'filter-urlize07': ('{{ a|urlize }}', {"a": "E mail me at me@example.com"}, 'Email me at <a href="mailto:me@example.com">me@example.com</a>'),138 'filter-urlize08': ('{{ a|urlize }}', {"a": "E mail me at <me@example.com>"}, 'Email me at <<a href="mailto:me@example.com">me@example.com</a>>'),137 'filter-urlize07': ('{{ a|urlize }}', {"a": "E-mail me at me@example.com"}, 'E-mail me at <a href="mailto:me@example.com">me@example.com</a>'), 138 'filter-urlize08': ('{{ a|urlize }}', {"a": "E-mail me at <me@example.com>"}, 'E-mail me at <<a href="mailto:me@example.com">me@example.com</a>>'), 139 139 140 140 'filter-urlizetrunc01': ('{% autoescape off %}{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}{% endautoescape %}', {"a": '"Unsafe" http://example.com/x=&y=', "b": mark_safe('"Safe" http://example.com?x=&y=')}, u'"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> "Safe" <a href="http://example.com?x=&y=" rel="nofollow">http:...</a>'), 141 141 'filter-urlizetrunc02': ('{{ a|urlizetrunc:"8" }} {{ b|urlizetrunc:"8" }}', {"a": '"Unsafe" http://example.com/x=&y=', "b": mark_safe('"Safe" http://example.com?x=&y=')}, u'"Unsafe" <a href="http://example.com/x=&y=" rel="nofollow">http:...</a> "Safe" <a href="http://example.com?x=&y=" rel="nofollow">http:...</a>'), -
tests/regressiontests/test_client_regress/models.py
153 153 "An assertion is raised if the form name is unknown" 154 154 post_data = { 155 155 'text': 'Hello World', 156 'email': 'not an e mail address',156 'email': 'not an e-mail address', 157 157 'value': 37, 158 158 'single': 'b', 159 159 'multi': ('b','c','e') … … 171 171 "An assertion is raised if the field name is unknown" 172 172 post_data = { 173 173 'text': 'Hello World', 174 'email': 'not an e mail address',174 'email': 'not an e-mail address', 175 175 'value': 37, 176 176 'single': 'b', 177 177 'multi': ('b','c','e') … … 189 189 "An assertion is raised if the field doesn't have any errors" 190 190 post_data = { 191 191 'text': 'Hello World', 192 'email': 'not an e mail address',192 'email': 'not an e-mail address', 193 193 'value': 37, 194 194 'single': 'b', 195 195 'multi': ('b','c','e') … … 207 207 "An assertion is raised if the field doesn't contain the provided error" 208 208 post_data = { 209 209 'text': 'Hello World', 210 'email': 'not an e mail address',210 'email': 'not an e-mail address', 211 211 'value': 37, 212 212 'single': 'b', 213 213 'multi': ('b','c','e') … … 228 228 """ 229 229 post_data = { 230 230 'text': 'Hello World', 231 'email': 'not an e mail address',231 'email': 'not an e-mail address', 232 232 'value': 37, 233 233 'single': 'b', 234 234 'multi': ('b','c','e')