py3 does not have string.letters
This commit is contained in:
parent
1db297169b
commit
c49f663d54
1 changed files with 3 additions and 1 deletions
|
@ -6,8 +6,10 @@ import string
|
|||
from six.moves.html_entities import name2codepoint
|
||||
from six import unichr, PY2, string_types
|
||||
|
||||
letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
|
||||
# Configuration for add_links() function
|
||||
|
||||
LEADING_PUNCTUATION = ['(', '<', '<']
|
||||
TRAILING_PUNCTUATION = ['.', ',', ')', '>', '\n', '>', "'", '"']
|
||||
|
||||
|
@ -89,7 +91,7 @@ def add_links(text, trim_url_limit=None, nofollow=False):
|
|||
if match:
|
||||
lead, middle, trail = match.groups()
|
||||
if middle.startswith('www.') or ('@' not in middle and not middle.startswith('http://') and \
|
||||
len(middle) > 0 and middle[0] in string.letters + string.digits and \
|
||||
len(middle) > 0 and middle[0] in letters + string.digits and \
|
||||
(middle.endswith('.org') or middle.endswith('.net') or middle.endswith('.com'))):
|
||||
middle = '<a href="http://%s"%s>%s</a>' % (middle, nofollow_attr, trim_url(middle))
|
||||
if middle.startswith('http://') or middle.startswith('https://'):
|
||||
|
|
Loading…
Reference in a new issue