X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/7fa400fc50e17b3c017615b296934945531fa715..c78a504deb6278063bebe9c25cf35c333b92eaa6:/forum/utils/html.py diff --git a/forum/utils/html.py b/forum/utils/html.py index 28a6a4b..256a2d8 100644 --- a/forum/utils/html.py +++ b/forum/utils/html.py @@ -1,6 +1,7 @@ """Utilities for working with HTML.""" #import html5lib from html5lib import sanitizer, serializer, tokenizer, treebuilders, treewalkers, HTMLParser +from urllib import quote_plus from django.utils.html import strip_tags from forum.utils.html2text import HTML2Text from django.utils.safestring import mark_safe @@ -50,7 +51,7 @@ def sanitize_html(html): return u''.join(output_generator) def cleanup_urls(url): - return strip_tags(url) + return quote_plus(strip_tags(url)) def html2text(s, ignore_tags=(), indent_width=4, page_width=80): @@ -68,7 +69,7 @@ def hyperlink(url, title, **attrs): return mark_safe('%s' % (url, " ".join('%s="%s"' % i for i in attrs.items()), title)) def objlink(obj, **attrs): - return hyperlink(settings.APP_BASE_URL + obj.get_absolute_url(), unicode(obj), **attrs) + return hyperlink(settings.APP_URL + obj.get_absolute_url(), unicode(obj), **attrs)