fix search and replace

This commit is contained in:
ldolse 2011-01-17 00:36:33 +08:00
commit f10e10f079

View file

@ -458,7 +458,10 @@ def __call__(self, html, remove_special_chars=None,
if search_pattern:
try:
search_re = re.compile(search_pattern)
rules.insert(0, (search_re, getattr(self.extra_opts, replace, '')))
replace_txt = getattr(self.extra_opts, replace, '')
if replace_txt == None:
replace_txt = ''
rules.insert(0, (search_re, replace_txt))
except Exception as e:
self.log.error('Failed to parse %s regexp because %s' % (search, e))