This commit is contained in:
tonio
2010-05-05 13:18:12 +02:00
parent 7480e479e7
commit 6adbc5c6be
9 changed files with 64 additions and 25 deletions
+15 -2
View File
@@ -349,8 +349,8 @@ class ImapListing(EmailListing):
self.mbc.criterions = ["(%s)" % criterions]
class ImapEmail(Email):
def __init__(self, msg, addrfull=False, **kwargs):
Email.__init__(self, msg, **kwargs)
def __init__(self, msg, addrfull=False, *args, **kwargs):
Email.__init__(self, msg, *args, **kwargs)
fields = ["Subject", "From", "To", "Reply-To", "Cc", "Date"]
for f in fields:
@@ -371,3 +371,16 @@ class ImapEmail(Email):
except:
pass
def render_headers(self, **kwargs):
attachments = []
for part in self.attachments:
decoded = decode_header(part.get_filename())
if decoded[0][1] is None:
attachments += [decoded[0][0]]
else:
attachments += [unicode(decoded[0][0], decoded[0][1])]
return render_to_string("webmail/headers.html", {
"headers" : self.headers,
"folder" : kwargs["folder"], "mail_id" : kwargs["mail_id"],
"attachments" : attachments != [] and attachments or None
})
+6 -7
View File
@@ -1,9 +1,8 @@
{% extends "common/mailheaders.html" %}
{% load i18n %}
<table id="emailheaders">
{% for hdr in headers %}
<tr><th width="130px">{{ hdr.name }}</th><td>{{ hdr.value }}</td></tr>
{% endfor %}
{% if attachments %}
{% block extraheaders %}
{% if attachments %}
<tr>
<th>{% trans "Attachments" %}</th>
<td>
@@ -13,5 +12,5 @@
{% endfor %}
</td>
</tr>
{% endif %}
</table>
{% endif %}
{% endblock %}