Skip to content

Commit

Permalink
Gracefully handle None in string_to_number
Browse files Browse the repository at this point in the history
  • Loading branch information
jace committed Feb 16, 2024
1 parent af1422c commit e615f90
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions hasjob/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,12 @@ def string_to_number(value):
"""
Convert a string containing a formatted number into an integer.
"""
if not value:
return None
value = NO_NUM_RE.sub('', value)
if value:
return int(value)
return None


#: This code adapted from http://en.wikipedia.org/wiki/Base_36#Python%5FConversion%5FCode
Expand Down

0 comments on commit e615f90

Please sign in to comment.