comparison core/html.py @ 985:9b197dbba34b

Fix image_check so it doesn't choke on empty input. Issue #88.
author Brian Neal <bgneal@gmail.com>
date Sun, 25 Oct 2015 13:54:56 -0500
parents 4619290d171d
children
comparison
equal deleted inserted replaced
984:7167c489bcdd 985:9b197dbba34b
73 73
74 If allowed_hosts is not None, it will be used as the whitelist of allowed 74 If allowed_hosts is not None, it will be used as the whitelist of allowed
75 hosts. If None, USER_IMAGES_SOURCES from settings will be used as the 75 hosts. If None, USER_IMAGES_SOURCES from settings will be used as the
76 whitelist. 76 whitelist.
77 """ 77 """
78 html = html.strip()
79 if not html:
80 return True
81
78 if not allowed_hosts: 82 if not allowed_hosts:
79 allowed_hosts = ALLOWED_HOSTS 83 allowed_hosts = ALLOWED_HOSTS
80 84
81 root = etree.HTML(html) 85 root = etree.HTML(html)
82 for img in root.iter('img'): 86 for img in root.iter('img'):