Fix search and replace.

This commit is contained in:
John Schember 2011-01-16 11:20:11 -05:00
parent ade8f7a797
commit 73e60f8c7e

View File

@ -458,7 +458,10 @@ class HTMLPreProcessor(object):
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))