From c49f663d54118d5f79bea353711241048b5ddbbf Mon Sep 17 00:00:00 2001 From: j Date: Fri, 25 Dec 2015 20:43:15 +0530 Subject: [PATCH] py3 does not have string.letters --- ox/html.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ox/html.py b/ox/html.py index 815f657..13524fd 100644 --- a/ox/html.py +++ b/ox/html.py @@ -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 = '%s' % (middle, nofollow_attr, trim_url(middle)) if middle.startswith('http://') or middle.startswith('https://'):