Fix error when attempting to match a nonexistent tag

svn: r16322
This commit is contained in:
Nick Hall 2010-12-29 22:15:47 +00:00
parent ff8cf61e99
commit ecb362848d

View File

@ -55,13 +55,15 @@ class HasTagBase(Rule):
""" """
Prepare the rule. Things we want to do just once. Prepare the rule. Things we want to do just once.
""" """
self.tag_handle = None
tag = db.get_tag_from_name(self.list[0]) tag = db.get_tag_from_name(self.list[0])
if tag is not None:
self.tag_handle = tag.get_handle() self.tag_handle = tag.get_handle()
def apply(self, db, obj): def apply(self, db, obj):
""" """
Apply the rule. Return True for a match. Apply the rule. Return True for a match.
""" """
if not self.list[0]: if self.tag_handle is None:
return False return False
return self.tag_handle in obj.get_tag_list() return self.tag_handle in obj.get_tag_list()