def image_fixups(content, msgid, archive, richformat, allowimgs): "Replace the CID links stored messages" html = local_fromstring(content) for element, attribute, link, _ in iterlinks(html): if not link.startswith('cid:'): if not allowimgs and attribute == 'src': element.attrib['src'] = '%simgs/blocked.gif' % media_url() element.attrib['title'] = link if richformat: if archive: displayurl = url('message-preview-archived-with-imgs', msgid=msgid) else: displayurl = url('message-preview-with-imgs', msgid=msgid) flash(ugettext('This message contains external' ' images, which have been blocked. ') + literal(link_to(ugettext('Display images'), displayurl))) else: imgname = link.replace('cid:', '') if archive: imgurl = url('messages-preview-archived-img', img=imgname.replace('/', '__xoxo__'), msgid=msgid) else: imgurl = url('messages-preview-img', img=imgname.replace('/', '__xoxo__'), msgid=msgid) element.attrib['src'] = imgurl return tostring(html)
def image_fixups(content, msgid, archive, richformat, allowimgs): "Replace the CID links stored messages" html = local_fromstring(content) for element, attribute, link, _ in iterlinks(html): if not link.startswith('cid:'): if not allowimgs and attribute == 'src': element.attrib['src'] = '%simgs/blocked.gif' % media_url() element.attrib['title'] = link if richformat: if archive: displayurl = url('message-preview-archived-with-imgs', msgid=msgid) else: displayurl = url('message-preview-with-imgs', msgid=msgid) flash( ugettext('This message contains external' ' images, which have been blocked. ') + literal(link_to(ugettext('Display images'), displayurl))) else: imgname = link.replace('cid:', '') if archive: imgurl = url('messages-preview-archived-img', img=imgname.replace('/', '__xoxo__'), msgid=msgid) else: imgurl = url('messages-preview-img', img=imgname.replace('/', '__xoxo__'), msgid=msgid) element.attrib['src'] = imgurl return tostring(html)
def img_fixups(content, queueid, allowimgs, richformat): "Replace the CID links in Queued messages" html = local_fromstring(content) for element, attribute, link, _ in iterlinks(html): if not link.startswith('cid:'): if not allowimgs and attribute == 'src': element.attrib['src'] = '%simgs/blocked.gif' % media_url() element.attrib['title'] = link if richformat: flash(ugettext('This message contains external ' 'images, which have been blocked. ') + literal(link_to(ugettext('Display images'), url('queue-preview-with-imgs', queueid=queueid)))) else: imgname = link.replace('cid:', '') element.attrib['src'] = url('queue-preview-img', imgid=imgname.replace('/', '__xoxo__'), queueid=queueid) return tostring(html)
def img_fixups(content, queueid, allowimgs, richformat): "Replace the CID links in Queued messages" html = local_fromstring(content) for element, attribute, link, _ in iterlinks(html): if not link.startswith('cid:'): if not allowimgs and attribute == 'src': element.attrib['src'] = '%simgs/blocked.gif' % media_url() element.attrib['title'] = link if richformat: flash( ugettext('This message contains external ' 'images, which have been blocked. ') + literal( link_to( ugettext('Display images'), url('queue-preview-with-imgs', queueid=queueid)))) else: imgname = link.replace('cid:', '') element.attrib['src'] = url('queue-preview-img', imgid=imgname.replace('/', '__xoxo__'), queueid=queueid) return tostring(html)