Ticket #6514: urlize.diff

File urlize.diff, 900 bytes (added by David Tulig, 17 years ago)

Escapes all ampersands.

  • django/utils/html.py

    diff --git a/django/utils/html.py b/django/utils/html.py
    index 33e2ee3..20ab895 100644
    a b def urlize(text, trim_url_limit=None, nofollow=False, autoescape=False):  
    106106                        urlquote(middle, safe='/&=:;#?+'),  nofollow_attr,
    107107                        trim_url(middle))
    108108            if middle.startswith('http://') or middle.startswith('https://'):
     109                middle = trim_url(middle)
    109110                middle = '<a href="%s"%s>%s</a>' % (
    110111                        urlquote(middle, safe='/&=:;#?+'), nofollow_attr,
    111                         trim_url(middle))
     112                        middle)
    112113            if '@' in middle and not middle.startswith('www.') and \
    113114                    not ':' in middle and simple_email_re.match(middle):
    114115                middle = '<a href="mailto:%s">%s</a>' % (middle, middle)
Back to Top