Django

Code

Ticket #7355: urlize-https-fix-tests.diff

File urlize-https-fix-tests.diff, 1.3 kB (added by clint, 5 months ago)
  • tests/regressiontests/defaultfilters/tests.py

    old new  
    166166>>> urlizetrunc(uri, 2) 
    167167u'<a href="http://31characteruri.com/test/" rel="nofollow">...</a>' 
    168168 
     169# Check normal urlize 
     170>>> url = 'https://google.com' 
     171>>> urlize(url) 
     172u'<a href="https://google.com" rel="nofollow">https://google.com</a>' 
     173 
    169174>>> wordcount('') 
    1701750 
    171176 
  • django/utils/html.py

    old new  
    9999         lead, middle, trail = match.groups() 
    100100         if safe_input: 
    101101             middle = mark_safe(middle) 
    102             if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \ 
     102            if middle.startswith('www.') or ('@' not in middle and not (middle.startswith('http://') or middle.startswith('https://')) and \ 
    103103                 len(middle) > 0 and middle[0] in string.ascii_letters + string.digits and \ 
    104104                 (middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))): 
    105105             middle = 'http://%s' % middle