Support only integers for this option.

fixes #478
This commit is contained in:
Antoine Nguyen
2013-09-09 09:29:19 +02:00
parent 80e8bd0564
commit c509cb4ede
2 changed files with 6 additions and 7 deletions
@@ -83,7 +83,7 @@ Webmail.prototype = {
$(document).on("click", "a[name=forward]", $.proxy(this.reply_loader, this));
$(document).on("click", "a[name=delete]", $.proxy(this.delete_message, this));
$(document).on("click", "a[name=activate_links]", $.proxy(function(e) { this.display_mode(e, "1"); }, this));
$(document).on("click", "a[name=disable_links]", $.proxy(function(e) { this.disable_mode(e, "0"); }, this));
$(document).on("click", "a[name=disable_links]", $.proxy(function(e) { this.display_mode(e, "0"); }, this));
$(document).on("click", "a[name=sendmail]", $.proxy(this.sendmail, this));
+5 -6
View File
@@ -23,7 +23,7 @@ class EmailAddress(object):
return self.fulladdress
class Email(object):
def __init__(self, msg, mformat="plain", dformat="plain", links="0"):
def __init__(self, msg, mformat="plain", dformat="plain", links=0):
self.attached_map = {}
self.contents = {"html" : "", "plain" : ""}
self.headers = []
@@ -78,7 +78,7 @@ class Email(object):
sometimes, messages embark inline images, which means they
must be displayed and not attached.
"""
if self.dformat == "html" and self.links != "0" \
if self.dformat == "html" and self.links \
and msg.has_key("Content-Disposition"):
if msg["Content-Disposition"].startswith("inline"):
cid = None
@@ -167,9 +167,9 @@ class Email(object):
def viewmail_html(self, content, **kwargs):
if content is None or content == "":
return ""
links = kwargs.has_key("links") and kwargs["links"] or "0"
html = lxml.html.fromstring(content)
if links == "0":
links = kwargs.get("links", 0)
html = lxml.html.fromstring(content)
if not links:
html.rewrite_links(lambda x: None)
else:
html.rewrite_links(self.map_cid)
@@ -179,7 +179,6 @@ class Email(object):
else:
body = lxml.html.tostring(body)
body = re.sub("<(/?)body", lambda m: "<%sdiv" % m.group(1), body)
body = Template(body).render(Context({}))
return body
def split_mailbox(mailbox):