From d0d4e56d0d2aeff4a977113c5ec17c9ec4e90714 Mon Sep 17 00:00:00 2001 From: Jeff Balogh Date: Fri, 30 May 2008 17:22:08 -0400 Subject: unwrapping urlparse result tuple manually for python 2.4 compatibility. In 2.5 the result is wrapped in a ParseResult class so that fields can be accessed by name, but a plain tuple is returned in 2.4. --- markdown.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/markdown.py b/markdown.py index acab09a..8978b89 100644 --- a/markdown.py +++ b/markdown.py @@ -34,7 +34,7 @@ __revision__ = "$Rev$" import re, sys, codecs -from urlparse import urlparse +from urlparse import urlparse, urlunparse from logging import getLogger, StreamHandler, Formatter, \ DEBUG, INFO, WARN, ERROR, CRITICAL @@ -930,9 +930,9 @@ class LinkPattern (Pattern): """ locless_schemes = ['', 'mailto', 'news'] - url = urlparse(url) + scheme, netloc, path, params, query, fragment = url = urlparse(url) safe_url = False - if url.netloc != '' or url.scheme in locless_schemes: + if netloc != '' or scheme in locless_schemes: safe_url = True for part in url[2:]: @@ -942,7 +942,7 @@ class LinkPattern (Pattern): if self.safe_mode and not safe_url: return '' else: - return url.geturl() + return urlunparse(url) class ImagePattern(LinkPattern): """ Return a NanoDom img Element from the given match. """ -- cgit v1.2.3