nmbug-status: Add a Python-3-compatible urllib.parse.quote import

Python 2's urllib.quote [1] has moved to urllib.parse.quote in Python
3 [2].

[1]: http://docs.python.org/2/library/urllib.html#urllib.quote
[2]: http://docs.python.org/3/library/urllib.parse.html#urllib.parse.quote
This commit is contained in:
W. Trevor King 2014-02-10 10:40:30 -08:00 committed by David Bremner
parent a6ff03df3f
commit 7b7a83cc32

View file

@ -12,7 +12,10 @@ import codecs
import datetime import datetime
import email.utils import email.utils
import locale import locale
import urllib try: # Python 3
from urllib.parse import quote
except ImportError: # Python 2
from urllib import quote
import json import json
import argparse import argparse
import os import os
@ -124,8 +127,8 @@ def print_view(database, title, query, comment,
if output_format == 'html': if output_format == 'html':
out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' \ out['subject'] = '<a href="http://mid.gmane.org/%s">%s</a>' % (
% (urllib.quote(mid), out['subject']) quote(mid), out['subject'])
lines.append(' <tr><td>%s' % out['date']) lines.append(' <tr><td>%s' % out['date'])
lines.append('</td><td>%s' % out['id']) lines.append('</td><td>%s' % out['id'])