<div dir="ltr"><div>On Fri, 27 Oct 2017, 18:52 Brian Sniffen, <<a href="mailto:bts@evenmere.org" target="_blank">bts@evenmere.org</a>> wrote:<br></div><div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Daniel Kahn Gillmor <<a href="mailto:dkg@fifthhorseman.net" target="_blank">dkg@fifthhorseman.net</a>> writes:<br>
<br>
> On Fri 2017-10-27 00:04:21 -0400, Brian Sniffen wrote:<br>
>> With bleach integrated (all of five lines), I think this is safe enough<br>
>> to let random notmuch users run it.<br>
><br>
> hm, bleach might be a little too aggressive.<br>
><br>
> jrollins just pointed toward:<br>
><br>
> <a href="https://nmweb.evenmere.org/show/87innmvvam.fsf%40ligo.caltech.edu" rel="noreferrer" target="_blank">https://nmweb.evenmere.org/show/87innmvvam.fsf%40ligo.caltech.edu</a><br>
<br>
That's fixed in 53403ecd, and there's some examples of bleach on a rope<br>
at<br>
<a href="https://nmweb.evenmere.org/show/20141107190321.GL23609%40odin.tremily.us" rel="noreferrer" target="_blank">https://nmweb.evenmere.org/show/20141107190321.GL23609%40odin.tremily.us</a><br>
<br>
The mbox URL is linkified, the many other link-like texts aren't.<br>
<br>
<br>
Next/prev links are at the bottom, and a thread listing.  I haven't<br>
thought through how to get the body delivered immediately, but speed<br>
seems acceptable.  Next up, some style revisions---and I'd love<br>
proposals for something that looks less awful, or at least makes the<br>
interface more clear.  UI design is a strong anti-specialty for me.<br></blockquote><div><br></div>I've been running this today - standalone on localhost port 80 with the built in CherryPy web server on my mail store. First impressions are it's terrific :-) As my intended 'target'<span style="font-size:13px"> mail store will be geared towards a 'internal work stuff knowledge collection', lots of emails contain html links to intranet pages and sites. I can adapt the bleach usage to suit (or just remove it), but along the way of searching and viewing mail, I've encountered quite a few occurrences of failing to UnicodeEncode. An example backtrace looks like this:</span><div><br></div><div><div><div>Traceback (most recent call last):</div><div>  File "/usr/lib/python2.7/dist-packages/web/application.py", line 239, in process</div><div>    return self.handle()</div><div>  File "/usr/lib/python2.7/dist-packages/web/application.py", line 230, in handle</div><div>    return self._delegate(fn, self.fvars, args)</div><div>  File "/usr/lib/python2.7/dist-packages/web/application.py", line 420, in _delegate</div><div>    return handle_class(cls)</div><div>  File "/usr/lib/python2.7/dist-packages/web/application.py", line 396, in handle_class</div><div>    return tocall(*args)</div><div>  File "/b/git/notmuch-brians.git/contrib/notmuch-web/nmweb.py", line 153, in GET</div><div>    sprefix=webprefix)</div><div>  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 989, in render</div><div>    return self.environment.handle_exception(exc_info, True)</div><div>  File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 754, in handle_exception</div><div>    reraise(exc_type, exc_value, tb)</div><div>  File "templates/show.html", line 1, in top-level template code</div><div>    {% extends "base.html" %}</div><div>  File "templates/base.html", line 32, in top-level template code</div><div>    {% block content %}</div><div>  File "templates/show.html", line 12, in block "content"</div><div>    {% for part in format_message(m.get_filename(),mid): %}{{ part|safe }}{% endfor %}</div><div>  File "/b/git/notmuch-brians.git/contrib/notmuch-web/nmweb.py", line 245, in format_message_walk</div><div>    tags=safe_tags).encode(part.get_content_charset('ascii')))</div><div>UnicodeEncodeError: 'latin-1' codec can't encode character u'\u201c' in position 1141: ordinal not in range(256)</div><div><br></div><div><a href="http://127.0.0.1:60968">127.0.0.1:60968</a> - - [31/Oct/2017 17:00:02] "HTTP/1.1 GET /show/<a href="mailto:665d8c5c2b024898ae21951c4b8b4f93@CO2PR05MB747.namprd05.prod.outlook.com">665d8c5c2b024898ae21951c4b8b4f93@CO2PR05MB747.namprd05.prod.outlook.com</a>" - 500 Internal Server Error</div></div></div><div><br></div><div>I'm no Python expert, but from a quick google it would seem like the cause of such an exception is related to not using utf-8.</div><div><br></div><div>Brian - do you think something needs modifying in nmweb.py to cater for this type of thing, or is this somehow related my own mailstore (not sure why that would be as my messages haven't been modified).</div><div>Cheers,</div><div>--  Matt</div><div><br></div></div></div></div></div>