[chronojump-server] Fixes the filename and adds the body as body.
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump-server] Fixes the filename and adds the body as body.
- Date: Sat, 25 Jul 2015 21:58:55 +0000 (UTC)
commit b4613dde252f2852a3a1a5df9096a8f9df8684cb
Author: Carles Pina i Estany <carles pina cat>
Date: Sat Jul 25 23:58:37 2015 +0200
Fixes the filename and adds the body as body.
email_error_log.py | 13 +++++++------
main.py | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/email_error_log.py b/email_error_log.py
index ebc5443..1cdeee4 100644
--- a/email_error_log.py
+++ b/email_error_log.py
@@ -10,7 +10,7 @@ def user_comments_from_log(log):
if log.startswith(user_comment_separator):
text = log.split(user_comment_separator)[1]
- return text
+ return "%s\ntext\n%s" % (user_comment_separator, user_comment_separator)
return ""
@@ -27,7 +27,7 @@ def metadata_to_dictionary(metadata):
return m
-def send(metadata_str, attachment_data):
+def send(metadata_str, filename, attachment_data):
metadata = metadata_to_dictionary(metadata_str)
d = {'user_comments':user_comments_from_log(attachment_data)}
@@ -40,18 +40,19 @@ $user_comments
El Servidor
""").substitute(d)
- emailMsg = email.MIMEMultipart.MIMEMultipart('mixed')
+ emailMsg = email.MIMEMultipart.MIMEMultipart()
emailMsg['Subject'] = "Crash log - %s - %s" % (metadata['version'],
metadata['email'])
emailMsg['From'] = config.get("notification_emails", "from")
emailMsg['To'] = config.get("notification_emails", "to")
- emailMsg.attach(email.mime.Text.MIMEText(body, 'text'))
+
+ emailMsg.attach(email.mime.Text.MIMEText(body))
# Now attach the file
fileMsg = email.mime.base.MIMEBase('application','octet/stream')
fileMsg.set_payload(attachment_data)
email.encoders.encode_base64(fileMsg)
- fileMsg.add_header('Content-Disposition','attachment;filename=test.bin')
+ fileMsg.add_header('Content-Disposition','attachment;filename="%s"' % (filename))
emailMsg.attach(fileMsg)
server = smtplib.SMTP('localhost')
@@ -68,4 +69,4 @@ this is a log
from C# :-)
"""
- send("1 5 2 0-email_del_usuari2 usuari com", data)
+ send("1 5 2 0-email_del_usuari2 usuari com", "this is the file.bin", data)
diff --git a/main.py b/main.py
index 388a388..1a6e6e2 100755
--- a/main.py
+++ b/main.py
@@ -66,7 +66,7 @@ def post_backtrace(email="unknown unknown com"):
hash = sha1.hexdigest()
date = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
filename = date + "-" + email_to_filename(email) + "-" + hash + ".bin"
- email_error_log.send(email_to_filename(email), data)
+ email_error_log.send(email_to_filename(email), filename, data)
backtraces_directory = config.get("api", "backtraces_directory")
create_directory(backtraces_directory)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]