Skip to content

Commit

Permalink
Merge pull request #22 from vikingco/MVBE-8919/sms-code-parse
Browse files Browse the repository at this point in the history
Parse smses with a * hook correctly
  • Loading branch information
Jens Veraa authored Jun 16, 2016
2 parents 356cd43 + b58e9c0 commit a61cd7a
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions smsgateway/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@ def _match_keywords(content, hooks):

# If nothing matched, see if there is a wildcard
if not matched and '*' in hooks:
hook = hooks['*']
matched = True

if matched:
# Split off the keyword
remaining_content = content.split(' ', 1)[1] if ' ' in content else ''

# There are multiple subkeywords, recurse
if isinstance(hook, dict):
return _match_keywords(remaining_content, hook)
# This is the callable, we're done
else:
return remaining_content
return content

# Split off the keyword
remaining_content = content.split(' ', 1)[1] if ' ' in content else ''

# There are multiple subkeywords, recurse
if isinstance(hook, dict):
return _match_keywords(remaining_content, hook)
# This is the callable, we're done
else:
return remaining_content


def parse_sms(content):
Expand Down

0 comments on commit a61cd7a

Please sign in to comment.