Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions plugins/filters/string_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def clean(string):
def count(haystack, needle):
haystack = _string_sanity_check(haystack)
needle = _string_sanity_check(needle)
if needle is '' or needle is None:
if needle == '' or needle is None:
return 0
return haystack.count(needle)

Expand All @@ -68,7 +68,7 @@ def dasherize(string):

def decapitalize(string):
sanitzed_string = _string_sanity_check(string)
if sanitzed_string is '' or sanitzed_string is None:
if sanitzed_string == '' or sanitzed_string is None:
return ''
return sanitzed_string[0].lower() + sanitzed_string[1:]

Expand All @@ -78,7 +78,7 @@ def decapitalize(string):

def dedent(string):
sanitzed_string = _string_sanity_check(string)
if sanitzed_string is '' or sanitzed_string is None:
if sanitzed_string == '' or sanitzed_string is None:
return ''
return textwrap.dedent(sanitzed_string)

Expand Down Expand Up @@ -113,7 +113,7 @@ def escape_html(haystack):


def humanize(string):
if string is '' or string is None:
if string == '' or string is None:
return ''
sanitzed_string = _string_sanity_check(string)
underscored = underscore(sanitzed_string)
Expand Down