5
5
from sys import modules
6
6
7
7
from future .utils import python_2_unicode_compatible
8
-
8
+ from six import string_types
9
9
from splitio .transformers import AsDateHourMinuteTimestampTransformMixin , \
10
10
AsNumberTransformMixin , AsDateTimestampTransformMixin , TransformMixin
11
11
@@ -485,7 +485,8 @@ def match(self, key):
485
485
:return: True under the conditiones described above
486
486
:rtype: bool
487
487
"""
488
- return any (key .startswith (s ) for s in self ._whitelist )
488
+ return (isinstance (key , string_types ) and
489
+ any (key .startswith (s ) for s in self ._whitelist ))
489
490
490
491
@python_2_unicode_compatible
491
492
def __str__ (self ):
@@ -512,7 +513,8 @@ def match(self, key):
512
513
:return: True under the conditiones described above
513
514
:rtype: bool
514
515
"""
515
- return any (key .endswith (s ) for s in self ._whitelist )
516
+ return (isinstance (key , string_types ) and
517
+ any (key .endswith (s ) for s in self ._whitelist ))
516
518
517
519
@python_2_unicode_compatible
518
520
def __str__ (self ):
@@ -539,7 +541,8 @@ def match(self, key):
539
541
:return: True under the conditiones described above
540
542
:rtype: bool
541
543
"""
542
- return any (s in key for s in self ._whitelist )
544
+ return (isinstance (key , string_types ) and
545
+ any (s in key for s in self ._whitelist ))
543
546
544
547
@python_2_unicode_compatible
545
548
def __str__ (self ):
@@ -664,7 +667,7 @@ def match(self, key):
664
667
"""
665
668
try :
666
669
setkey = set (key )
667
- return setkey .issubset (set (self ._whitelist ))
670
+ return len ( setkey ) > 0 and setkey .issubset (set (self ._whitelist ))
668
671
except TypeError :
669
672
return False
670
673
0 commit comments