Django

Code

Changeset 7701

Show
Ignore:
Timestamp:
06/19/08 07:05:39 (3 months ago)
Author:
russellm
Message:

Fixed #7355 -- Modified urlize utility to handle https:// addresses. Thanks for the report and patch, clint.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/html.py

    r7079 r7701  
    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'))): 
  • django/trunk/tests/regressiontests/defaultfilters/tests.py

    r7575 r7701  
    167167u'<a href="http://31characteruri.com/test/" rel="nofollow">...</a>' 
    168168 
     169# Check normal urlize 
     170>>> urlize('http://google.com')  
     171u'<a href="http://google.com" rel="nofollow">http://google.com</a>' 
     172 
     173>>> urlize('http://google.com/')  
     174u'<a href="http://google.com/" rel="nofollow">http://google.com/</a>' 
     175 
     176>>> urlize('www.google.com')  
     177u'<a href="http://www.google.com" rel="nofollow">http://www.google.com</a>' 
     178 
     179>>> urlize('djangoproject.org')  
     180u'<a href="http://djangoproject.org" rel="nofollow">http://djangoproject.org</a>' 
     181 
     182>>> urlize('info@djangoproject.org')  
     183u'<a href="mailto:info@djangoproject.org">info@djangoproject.org</a>' 
     184 
     185# Check urlize with https addresses 
     186>>> urlize('https://google.com')  
     187u'<a href="https://google.com" rel="nofollow">https://google.com</a>' 
     188 
     189 
    169190>>> wordcount('') 
    1701910