Permalink
Browse files

rename payload as content

  • Loading branch information...
anandology committed Mar 10, 2010
1 parent 3d8e886 commit 2194072be68d514eaf758f75bd6eda896f9dec77
Showing with 7 additions and 7 deletions.
  1. +1 −1 web/debugerror.py
  2. +6 −6 web/utils.py
View
@@ -332,7 +332,7 @@ def emailerrors_internal():
"bug: %(error_name)s: %(error_value)s (%(path)s)" % locals(),
message,
attachments=[
- dict(filename="bug.html", payload=safestr(djangoerror()))
+ dict(filename="bug.html", content=safestr(djangoerror()))
],
)
return error
View
@@ -1254,8 +1254,8 @@ def sendmail(from_address, to_address, subject, message, headers=None, **kw):
`headers.
Optionally cc, bcc and attachments can be specified as keyword arguments.
- Attachments must be a list and each attachment can be either a file object
- or a dictionary with filename, payload and optionally content_type keys.
+ Attachments must be an iterable and each attachment can be either a file object
+ or a dictionary with filename, content and optionally content_type keys.
If `web.config.smtp_server` is set, it will send the message
to that SMTP server. Otherwise it will look for
@@ -1266,7 +1266,7 @@ def sendmail(from_address, to_address, subject, message, headers=None, **kw):
for a in attachments or []:
if isinstance(a, dict):
- mail.attach(a['filename'], a['payload'], a.get('content_type'))
+ mail.attach(a['filename'], a['content'], a.get('content_type'))
elif hasattr(a, 'read'): # file
filename = getattr(a, "name", "")
content_type = getattr(a, 'content_type', None)
@@ -1321,11 +1321,11 @@ def new_message(self):
return Message()
- def attach(self, filename, payload, content_type=None):
+ def attach(self, filename, content, content_type=None):
if not self.multipart:
msg = self.new_message()
msg.add_header("Content-Type", "multipart/mixed")
- msg.attach(self.message)
+ msg.attach(self.message)
self.message = msg
self.multipart = True
@@ -1338,7 +1338,7 @@ def attach(self, filename, payload, content_type=None):
content_type = content_type or mimetypes.guess_type(filename)[0] or "applcation/octet-stream"
msg = self.new_message()
- msg.set_payload(payload)
+ msg.set_payload(content)
msg.add_header('Content-Type', content_type)
msg.add_header('Content-Disposition', 'attachment', filename=filename)

0 comments on commit 2194072

Please sign in to comment.