Skip to content
This repository
Browse code

squash resource warning on python 3.2

  • Loading branch information...
commit 97eeef4d392fcc22b368e1eacf24e9c5f5feed94 1 parent 95ff3e7
Chris McDonough authored March 20, 2012

Showing 1 changed file with 3 additions and 1 deletion. Show diff stats Hide diff stats

  1. 4  pyramid_mailer/response.py
4  pyramid_mailer/response.py
@@ -248,7 +248,9 @@ def _encode_attachment(self, filename=None, content_type=None, data=None,
248 248
             self.base.parts.append(part)
249 249
         elif filename:
250 250
             if not data:
251  
-                data = open(filename).read()
  251
+                f = open(filename)
  252
+                data = f.read()
  253
+                f.close()
252 254
 
253 255
             self.base.attach_file(filename, data, content_type,
254 256
                                   disposition or 'attachment')

0 notes on commit 97eeef4

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