aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeff Balogh <its.jeff.balogh@gmail.com>2008-05-30 17:22:08 -0400
committerYuri Takhteyev <yuri@freewisdom.org>2008-05-30 14:44:59 -0700
commitd0d4e56d0d2aeff4a977113c5ec17c9ec4e90714 (patch)
treeadf95b34dd1b7dab2b0cc2d0587a9b4b38277225
parent321d313720f855ad40a18c2e4e159ebe4f7ce335 (diff)
downloadmarkdown-d0d4e56d0d2aeff4a977113c5ec17c9ec4e90714.tar.gz
markdown-d0d4e56d0d2aeff4a977113c5ec17c9ec4e90714.tar.bz2
markdown-d0d4e56d0d2aeff4a977113c5ec17c9ec4e90714.zip
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.
-rw-r--r--markdown.py8
1 files 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. """