Reworked `be list --extra-strings REGEXP` logic.
authorW. Trevor King <wking@drexel.edu>
Fri, 25 Jun 2010 18:49:39 +0000 (14:49 -0400)
committerW. Trevor King <wking@drexel.edu>
Fri, 25 Jun 2010 18:49:39 +0000 (14:49 -0400)
Previous implementation only matched if *every* regexp matched *every*
string.  Current implementation matches is *any* regexp matches *any*
string.

libbe/command/list.py

index 197604b6cf4d8f23adb6e1e38d196033fd907bc3..c62e5a41c0d3775e7ec0b01aa3f6143855759f65 100644 (file)
@@ -63,10 +63,16 @@ class Filter (object):
             if len(self.extra_strings_regexps) > 0:
                 return False
         else:
+            matched = False
             for string in bug.extra_strings:
                 for regexp in self.extra_strings_regexps:
-                    if not regexp.match(string):
-                        return False
+                    if regexp.match(string):
+                        matched = True
+                        break
+                if matched == True:
+                    break
+            if matched == False:
+                return False
         return True
 
 class List (libbe.command.Command):