foundation for filtering binary string values (for example, replacement of non readable chars with #)

This commit is contained in:
Miroslav Stampar
2011-01-04 21:56:37 +00:00
parent aa81ed4033
commit c83e9f6ca5
2 changed files with 4 additions and 1 deletions

View File

@@ -1806,7 +1806,7 @@ def removeDynamicContent(page):
return page
def filterStringValue(value, regex):
def filterStringValue(value, regex, replace=None):
"""
Returns string value consisting only
of chars satisfying supplied regular
@@ -1818,6 +1818,8 @@ def filterStringValue(value, regex):
for char in value:
if re.search(regex, char):
retVal += char
elif replace:
retVal += replace
return retVal