Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #12147 -- Replaced use of try-except-finally to allow for Pytho…

…n 2.4 support. Thanks to knutin for the report.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11721 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 90a9f81d377b17c0df08faac5aa0fdd412508123 1 parent dd5d762
Russell Keith-Magee authored November 04, 2009

Showing 1 changed file with 14 additions and 11 deletions. Show diff stats Hide diff stats

  1. 25  django/core/mail/backends/console.py
25  django/core/mail/backends/console.py
@@ -18,17 +18,20 @@ def send_messages(self, email_messages):
18 18
             return
19 19
         self._lock.acquire()
20 20
         try:
21  
-            stream_created = self.open()
22  
-            for message in email_messages:
23  
-                self.stream.write('%s\n' % message.message().as_string())
24  
-                self.stream.write('-'*79)
25  
-                self.stream.write('\n')
26  
-                self.stream.flush()  # flush after each message
27  
-            if stream_created:
28  
-                self.close()
29  
-        except:
30  
-            if not self.fail_silently:
31  
-                raise
  21
+            # The try-except is nested to allow for
  22
+            # Python 2.4 support (Refs #12147)
  23
+            try:
  24
+                stream_created = self.open()
  25
+                for message in email_messages:
  26
+                    self.stream.write('%s\n' % message.message().as_string())
  27
+                    self.stream.write('-'*79)
  28
+                    self.stream.write('\n')
  29
+                    self.stream.flush()  # flush after each message
  30
+                if stream_created:
  31
+                    self.close()
  32
+            except:
  33
+                if not self.fail_silently:
  34
+                    raise
32 35
         finally:
33 36
             self._lock.release()
34 37
         return len(email_messages)

0 notes on commit 90a9f81

Please sign in to comment.
Something went wrong with that request. Please try again.