Skip to content
Snippets Groups Projects
Commit 45d6820f authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

add protection in the type.

parent 3d9d3f33
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,17 @@ def CLEAN_COMMA(value): ...@@ -11,7 +11,17 @@ def CLEAN_COMMA(value):
"""Remove trailing comma(s). """Remove trailing comma(s).
Search patterns are: ',' or ', ' or ' ,, ' ... Search patterns are: ',' or ', ' or ' ,, ' ...
@type value: str or unicode
@param value:
@rtype: str or unicode
@note: return the value unchanged when it is not a string.
""" """
if not isinstance(value, (str, unicode)):
return value
return re.sub(REG_COMMA, '', value) return re.sub(REG_COMMA, '', value)
...@@ -23,6 +33,11 @@ def CLEAN_SPACES(value): ...@@ -23,6 +33,11 @@ def CLEAN_SPACES(value):
@param value: @param value:
@rtype: str or unicode @rtype: str or unicode
@note: return the value unchanged when it is not a string.
""" """
if not isinstance(value, (str, unicode)):
return value
return ' '.join(value.strip().split()) return ' '.join(value.strip().split())
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment