def requestprepare(self, dbase):
"""
Request that the prepare method of the rule is executed if needed
Special: Custom Filters have fixed values, so only one instance needs to
exists during a search. It is stored in a FilterStore, and initialized
once.
As filters are can be grouped in a group
filter, we request a prepare. Only the first time prepare will be
called
"""
if self.nrprepare == 0:
if self.use_regex:
self.regex = [None]*len(self.labels)
for i in range(len(self.labels)):
if self.list[i]:
try:
self.regex[i] = re.compile(self.list[i], re.I)
except re.error:
self.regex[i] = re.compile('')
self.match_substring = self.match_regex
self.prepare(dbase)
self.nrprepare += 1
评论列表
文章目录