html_mime_header.diff removed, fixed upstream

parent d3ac1b56
......@@ -7,6 +7,7 @@ dico (2.7-1) UNRELEASED; urgency=medium
* New upstream release:
+ use new '--with-libWN' configure option and remove
'wordnet.diff' patch.
+ remove 'html_mime_header.diff' patch, fixed upstream
-- Marc Dequènes (Duck) <Duck@DuckCorp.org> Fri, 09 Nov 2018 23:06:40 +0900
......
Description: dicoweb: Fix handling of text/html content type.
* app/python/mediawiki.py: Fix python 3 compatibility.
* dicoweb/views.py (index): set format_html to true if Content-Type
is text/html
Origin: commit:9a2bf8e9c38ec944bc7fdf678341450db97f250d
From: Sergey Poznyakoff <gray@gnu.org>
Date: Sat, 01 Sep 2018 19:54:25 +0000
Bug-Debian: https://bugs.debian.org/892717
---
diff --git a/app/python/mediawiki.py b/app/python/mediawiki.py
index ea70ed8..97bf3aa 100644
--- a/app/python/mediawiki.py
+++ b/app/python/mediawiki.py
@@ -29,6 +29,10 @@ if sys.version_info[0] > 2:
from urllib.error import URLError
from urllib.parse import quote as url_quote
from html.entities import name2codepoint
+ class unicode(str):
+ pass
+ def unichr(c):
+ return chr(c)
else:
from urllib2 import urlopen, Request, quote as url_quote, URLError
from htmlentitydefs import name2codepoint
diff --git a/dicoweb/views.py b/dicoweb/views.py
index 7b71cee..95ebed9 100644
--- a/dicoweb/views.py
+++ b/dicoweb/views.py
@@ -179,17 +179,20 @@ def index(request):
if 'definitions' in result:
rx1 = re.compile('{+(.*?)}+', re.DOTALL)
for df in result['definitions']:
- if 'content-type' in df \
- and df['content-type'].startswith('text/x-wiki') \
- and wiki2html:
- lang = df['x-wiki-language'] \
- if 'x-wiki-language' in df else 'en'
- wikiparser = wiki2html.HtmlWiktionaryMarkup(text=df['desc'],
- html_base='?q=',
- lang=lang)
- wikiparser.parse()
- df['desc'] = str(wikiparser)
- df['format_html'] = True
+ if 'content-type' in df:
+ if (df['content-type'].startswith('text/x-wiki')
+ and wiki2html):
+ lang = df['x-wiki-language'] \
+ if 'x-wiki-language' in df else 'en'
+ wikiparser = wiki2html.HtmlWiktionaryMarkup(
+ text=df['desc'],
+ html_base='?q=',
+ lang=lang)
+ wikiparser.parse()
+ df['desc'] = str(wikiparser)
+ df['format_html'] = True
+ elif df['content-type'].startswith('text/html'):
+ df['format_html'] = True
else:
df['desc'] = re.sub('_(.*?)_', '<b>\\1</b>', df['desc'])
df['desc'] = re.sub(rx1, __subs1, df['desc'])
--
cgit v0.9.0.3
References
Visible links
. mailto:gray@gnu.org
dicoweb-debian.diff
undef-gets.diff
py3.diff
html_mime_header.diff
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment