From a5ad4621c9251a5c69184c4f0d00da62565eab8e Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 16 May 2011 20:09:12 +0000 Subject: [PATCH] minor refactoring --- lib/core/common.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 187b4980f..a3031add1 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -2344,17 +2344,12 @@ def filterListValue(value, regex): expression """ - if regex: - retVal = [] - filt = getCompiledRegex(regex, re.I) - - for word in value: - if filt.search(word): - retVal.append(word) - - return retVal + if isinstance(value, list) and regex: + retVal = filter(lambda word: getCompiledRegex(regex, re.I).search(word), value) else: - return value + retVal = value + + return retVal def showHttpErrorCodes(): """